Author: jgardou Date: Mon Mar 5 19:18:19 2012 New Revision: 56048
URL: http://svn.reactos.org/svn/reactos?rev=56048&view=rev Log: [CABINET] - Really use random temporary file name
Modified: trunk/reactos/tools/cabman/cabinet.cxx
Modified: trunk/reactos/tools/cabman/cabinet.cxx URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/cabinet.cxx?re... ============================================================================== --- trunk/reactos/tools/cabman/cabinet.cxx [iso-8859-1] (original) +++ trunk/reactos/tools/cabman/cabinet.cxx [iso-8859-1] Mon Mar 5 19:18:19 2012 @@ -115,7 +115,7 @@ }
-ULONG CCFDATAStorage::Create(const char* FileName) +ULONG CCFDATAStorage::Create() /* * FUNCTION: Creates the file * ARGUMENTS: @@ -124,13 +124,16 @@ * 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; - - strcat(FullName, FileName); + if(GetTempFileName(tmpPath, "cab", 0, FullName) == 0) + return CAB_STATUS_CANNOT_CREATE;
/* Create file, overwrite if it already exists */ FileHandle = CreateFile(FullName, // Create this file @@ -1529,7 +1532,7 @@ return CAB_STATUS_NOMEMORY; }
- Status = ScratchFile->Create("~CAB.tmp"); + Status = ScratchFile->Create();
CreateNewFolder = false;