From 4a78d2e9885a78e9ffb4079ecee0261b8e29415b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Mon, 5 Mar 2012 19:18:19 +0000 Subject: [PATCH] [CABINET] - Really use random temporary file name svn path=/trunk/; revision=56048 --- reactos/tools/cabman/cabinet.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/reactos/tools/cabman/cabinet.cxx b/reactos/tools/cabman/cabinet.cxx index 18fe3396893..fe0bd4d503d 100644 --- a/reactos/tools/cabman/cabinet.cxx +++ b/reactos/tools/cabman/cabinet.cxx @@ -115,7 +115,7 @@ CCFDATAStorage::~CCFDATAStorage() } -ULONG CCFDATAStorage::Create(const char* FileName) +ULONG CCFDATAStorage::Create() /* * FUNCTION: Creates the file * ARGUMENTS: @@ -124,13 +124,16 @@ ULONG CCFDATAStorage::Create(const char* FileName) * Status of operation */ { +#if defined(_WIN32) + char tmpPath[MAX_PATH]; +#endif ASSERT(!FileCreated); #if defined(_WIN32) - if (GetTempPath(MAX_PATH, FullName) == 0) + if (GetTempPath(MAX_PATH, tmpPath) == 0) + return CAB_STATUS_CANNOT_CREATE; + if(GetTempFileName(tmpPath, "cab", 0, FullName) == 0) return CAB_STATUS_CANNOT_CREATE; - - strcat(FullName, FileName); /* Create file, overwrite if it already exists */ FileHandle = CreateFile(FullName, // Create this file @@ -1529,7 +1532,7 @@ ULONG CCabinet::NewCabinet() return CAB_STATUS_NOMEMORY; } - Status = ScratchFile->Create("~CAB.tmp"); + Status = ScratchFile->Create(); CreateNewFolder = false;