Author: tkreuzer Date: Sun Jun 26 22:17:01 2011 New Revision: 52475
URL: http://svn.reactos.org/svn/reactos?rev=52475&view=rev Log: [CABMAN/CDMAKE] check for _WIN32 instead of WIN32, fixes compilation with amd64 toolchain
Modified: trunk/reactos/tools/cabman/cabinet.cxx trunk/reactos/tools/cabman/cabinet.h trunk/reactos/tools/cabman/dfp.cxx trunk/reactos/tools/cdmake/cdmake.c
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] Sun Jun 26 22:17:01 2011 @@ -18,7 +18,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#if !defined(WIN32) +#if !defined(_WIN32) # include <dirent.h> # include <sys/stat.h> # include <sys/types.h> @@ -27,7 +27,7 @@ #include "raw.h" #include "mszip.h"
-#if defined(WIN32) +#if defined(_WIN32) #define GetSizeOfFile(handle) _GetSizeOfFile(handle) static LONG _GetSizeOfFile(FILEHANDLE handle) { @@ -126,7 +126,7 @@ { ASSERT(!FileCreated);
-#if defined(WIN32) +#if defined(_WIN32) if (GetTempPath(MAX_PATH, FullName) == 0) return CAB_STATUS_CANNOT_CREATE;
@@ -147,7 +147,7 @@ DPRINT(MID_TRACE, ("ERROR '%u'.\n", (UINT)GetLastError())); return CAB_STATUS_CANNOT_CREATE; } -#else /* !WIN32 */ +#else /* !_WIN32 */ /*if (tmpnam(FullName) == NULL)*/ if ((FileHandle = tmpfile()) == NULL) return CAB_STATUS_CANNOT_CREATE; @@ -190,12 +190,12 @@ * Status of operation */ { -#if defined(WIN32) +#if defined(_WIN32) if( SetFilePointer(FileHandle, 0, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER ) return CAB_STATUS_FAILURE; if (!SetEndOfFile(FileHandle)) return CAB_STATUS_FAILURE; -#else /* !WIN32 */ +#else /* !_WIN32 */ fclose(FileHandle); FileHandle = tmpfile(); if (FileHandle == NULL) @@ -215,7 +215,7 @@ * Current position */ { -#if defined(WIN32) +#if defined(_WIN32) return SetFilePointer(FileHandle, 0, NULL, FILE_CURRENT); #else return (ULONG)ftell(FileHandle); @@ -232,7 +232,7 @@ * Status of operation */ { -#if defined(WIN32) +#if defined(_WIN32) if( SetFilePointer(FileHandle, Position, NULL, @@ -260,7 +260,7 @@ * Status of operation */ { -#if defined(WIN32) +#if defined(_WIN32) if (!ReadFile(FileHandle, Buffer, Data->CompSize, (LPDWORD)BytesRead, NULL)) return CAB_STATUS_CANNOT_READ; #else @@ -284,7 +284,7 @@ * Status of operation */ { -#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, Buffer, Data->CompSize, (LPDWORD)BytesWritten, NULL)) return CAB_STATUS_CANNOT_WRITE; #else @@ -394,7 +394,7 @@ i = 0; while (Path[i] != 0) { -#if defined(WIN32) +#if defined(_WIN32) if (Path[i] == '/') newpath[i] = '\'; else @@ -632,7 +632,7 @@ FILEHANDLE FileHandle; ULONG BytesRead;
-#if defined(WIN32) +#if defined(_WIN32) FileHandle = CreateFile(ConvertPath(FileName, true), // Open this file GENERIC_READ, // Open for reading FILE_SHARE_READ, // Share for reading @@ -645,7 +645,7 @@ DPRINT(MID_TRACE, ("Cannot open cabinet reserved file.\n")); return false; } -#else /* !WIN32 */ +#else /* !_WIN32 */ FileHandle = fopen(ConvertPath(FileName, true), "rb"); if (FileHandle == NULL) { @@ -730,7 +730,7 @@ if (!OutputBuffer) return CAB_STATUS_NOMEMORY;
-#if defined(WIN32) +#if defined(_WIN32) FileHandle = CreateFile(CabinetName, // Open this file GENERIC_READ, // Open for reading FILE_SHARE_READ, // Share for reading @@ -744,7 +744,7 @@ DPRINT(MID_TRACE, ("Cannot open file.\n")); return CAB_STATUS_CANNOT_OPEN; } -#else /* !WIN32 */ +#else /* !_WIN32 */ FileHandle = fopen(CabinetName, "rb"); if (FileHandle == NULL) { @@ -791,7 +791,7 @@ FolderReserved = (Size >> 16) & 0xFF; DataReserved = (Size >> 24) & 0xFF;
-#if defined(WIN32) +#if defined(_WIN32) if (SetFilePointer(FileHandle, CabinetReserved, NULL, FILE_CURRENT) == INVALID_SET_FILE_POINTER) { DPRINT(MIN_TRACE, ("SetFilePointer() failed, error code is %u.\n", (UINT)GetLastError())); @@ -1027,7 +1027,7 @@ CFDATA CFData; ULONG Status; bool Skip; -#if defined(WIN32) +#if defined(_WIN32) FILETIME FileTime; #endif CHAR DestName[MAX_PATH]; @@ -1066,7 +1066,7 @@ strcat(DestName, FileName);
/* Create destination file, fail if it already exists */ -#if defined(WIN32) +#if defined(_WIN32) DestFile = CreateFile(DestName, // Create this file GENERIC_WRITE, // Open for writing 0, // No sharing @@ -1099,7 +1099,7 @@ return CAB_STATUS_CANNOT_CREATE; } } -#else /* !WIN32 */ +#else /* !_WIN32 */ DestFile = fopen(DestName, "rb"); if (DestFile != NULL) { @@ -1121,7 +1121,7 @@ return CAB_STATUS_CANNOT_CREATE; } #endif -#if defined(WIN32) +#if defined(_WIN32) if (!DosDateTimeToFileTime(File->File.FileDate, File->File.FileTime, &FileTime)) { CloseFile(DestFile); @@ -1147,7 +1147,7 @@ OnExtract(&File->File, FileName);
/* Search to start of file */ -#if defined(WIN32) +#if defined(_WIN32) Offset = SetFilePointer(FileHandle, File->DataBlock->AbsoluteOffset, NULL, @@ -1273,7 +1273,7 @@ File->DataBlock = CurrentFolderNode->DataListHead;
/* Search to start of file */ -#if defined(WIN32) +#if defined(_WIN32) if( SetFilePointer(FileHandle, File->DataBlock->AbsoluteOffset, NULL, @@ -1347,7 +1347,7 @@ CFData.CompSize, CFData.UncompSize));
/* Go to next data block */ -#if defined(WIN32) +#if defined(_WIN32) if( SetFilePointer(FileHandle, CurrentDataNode->AbsoluteOffset + sizeof(CFDATA) + CurrentDataNode->Data.CompSize, @@ -1386,7 +1386,7 @@ (UINT)BytesSkipped, (UINT)Skip, (UINT)Size));
-#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(DestFile, (void*)((PUCHAR)OutputBuffer + BytesSkipped), BytesToWrite, (LPDWORD)&BytesWritten, NULL) || (BytesToWrite != BytesWritten)) @@ -1625,7 +1625,7 @@ if (!ContinueFile) { /* Try to open file */ -#if defined(WIN32) +#if defined(_WIN32) SourceFile = CreateFile( FileNode->FileName, // Open this file GENERIC_READ, // Open for reading @@ -1639,7 +1639,7 @@ DPRINT(MID_TRACE, ("File not found (%s).\n", FileNode->FileName)); return CAB_STATUS_NOFILE; } -#else /* !WIN32 */ +#else /* !_WIN32 */ SourceFile = fopen(FileNode->FileName, "rb"); if (SourceFile == NULL) { @@ -1839,7 +1839,7 @@ OnCabinetName(CurrentDiskNumber, CabinetName);
/* Create file, fail if it already exists */ -#if defined(WIN32) +#if defined(_WIN32) FileHandle = CreateFile(CabinetName, // Create this file GENERIC_WRITE, // Open for writing 0, // No sharing @@ -1874,7 +1874,7 @@ return CAB_STATUS_CANNOT_CREATE; } } -#else /* !WIN32 */ +#else /* !_WIN32 */ FileHandle = fopen(CabinetName, "rb"); if (FileHandle != NULL) { @@ -2009,7 +2009,7 @@ ConvertPath(NewFileName, false);
/* Try to open file */ -#if defined(WIN32) +#if defined(_WIN32) SrcFile = CreateFile( NewFileName, // Open this file GENERIC_READ, // Open for reading @@ -2024,7 +2024,7 @@ FreeMemory(NewFileName); return CAB_STATUS_CANNOT_OPEN; } -#else /* !WIN32 */ +#else /* !_WIN32 */ SrcFile = fopen(NewFileName, "rb"); if (SrcFile == NULL) { @@ -2085,7 +2085,7 @@ PSEARCH_CRITERIA Criteria; ULONG Status;
-#if defined(WIN32) +#if defined(_WIN32) HANDLE hFind; WIN32_FIND_DATA FindFileData; #else @@ -2123,7 +2123,7 @@ { pszFile = Criteria->Search;
-#if defined(WIN32) +#if defined(_WIN32) szFilePath[0] = 0; #else // needed for opendir() @@ -2131,7 +2131,7 @@ #endif }
-#if defined(WIN32) +#if defined(_WIN32) // Windows: Use the easy FindFirstFile/FindNextFile API for getting all files and checking them against the pattern hFind = FindFirstFile(Criteria->Search, &FindFileData);
@@ -2479,7 +2479,7 @@ // + 1 to skip the terminating NULL character as well. Size = -(MaxLength - Size) + 1;
-#if defined(WIN32) +#if defined(_WIN32) if( SetFilePointer(FileHandle, (LONG)Size, NULL, @@ -2515,7 +2515,7 @@ (UINT)CABHeader.FileTableOffset));
/* Seek to file table */ -#if defined(WIN32) +#if defined(_WIN32) if( SetFilePointer(FileHandle, CABHeader.FileTableOffset, NULL, @@ -2603,7 +2603,7 @@ }
/* Seek to data block */ -#if defined(WIN32) +#if defined(_WIN32) if( SetFilePointer(FileHandle, AbsoluteOffset, NULL, @@ -2999,7 +2999,7 @@ retryFileName = FileName; break;
- case '?': + case '?': if (*FileName++ == '\0') return false;
@@ -3168,7 +3168,7 @@ CABHeader.CabinetSize = DiskSize;
/* Write header */ -#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, &CABHeader, sizeof(CFHEADER), (LPDWORD)&BytesWritten, NULL)) { DPRINT(MIN_TRACE, ("Cannot write to file.\n")); @@ -3191,7 +3191,7 @@ ReservedSize = CabinetReservedFileSize & 0xffff; ReservedSize |= (0 << 16); /* Folder reserved area size */ ReservedSize |= (0 << 24); /* Folder reserved area size */ -#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, &ReservedSize, sizeof(ULONG), (LPDWORD)&BytesWritten, NULL)) { DPRINT(MIN_TRACE, ("Cannot write to file.\n")); @@ -3206,7 +3206,7 @@ } #endif
-#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, CabinetReservedFileBuffer, CabinetReservedFileSize, (LPDWORD)&BytesWritten, NULL)) { DPRINT(MIN_TRACE, ("Cannot write to file.\n")); @@ -3228,7 +3228,7 @@
/* Write name of previous cabinet */ Size = (ULONG)strlen(CabinetPrev) + 1; -#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, CabinetPrev, Size, (LPDWORD)&BytesWritten, NULL)) { DPRINT(MIN_TRACE, ("Cannot write to file.\n")); @@ -3247,7 +3247,7 @@
/* Write label of previous disk */ Size = (ULONG)strlen(DiskPrev) + 1; -#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, DiskPrev, Size, (LPDWORD)&BytesWritten, NULL)) { DPRINT(MIN_TRACE, ("Cannot write to file.\n")); @@ -3269,7 +3269,7 @@
/* Write name of next cabinet */ Size = (ULONG)strlen(CabinetNext) + 1; -#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, CabinetNext, Size, (LPDWORD)&BytesWritten, NULL)) { DPRINT(MIN_TRACE, ("Cannot write to file.\n")); @@ -3288,7 +3288,7 @@
/* Write label of next disk */ Size = (ULONG)strlen(DiskNext) + 1; -#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, DiskNext, Size, (LPDWORD)&BytesWritten, NULL)) { DPRINT(MIN_TRACE, ("Cannot write to file.\n")); @@ -3328,7 +3328,7 @@ DPRINT(MAX_TRACE, ("Writing folder entry. CompressionType (0x%X) DataBlockCount (%d) DataOffset (0x%X).\n", FolderNode->Folder.CompressionType, FolderNode->Folder.DataBlockCount, (UINT)FolderNode->Folder.DataOffset));
-#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, &FolderNode->Folder, sizeof(CFFOLDER), @@ -3390,7 +3390,7 @@ DPRINT(MAX_TRACE, ("Writing file entry. FileControlID (0x%X) FileOffset (0x%X) FileSize (%u) FileName (%s).\n", File->File.FileControlID, (UINT)File->File.FileOffset, (UINT)File->File.FileSize, File->FileName));
-#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, &File->File, sizeof(CFFILE), @@ -3406,7 +3406,7 @@ } #endif
-#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, GetFileName(File->FileName), (DWORD)strlen(GetFileName(File->FileName)) + 1, @@ -3470,7 +3470,7 @@ return Status; }
-#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, &DataNode->Data, sizeof(CFDATA), (LPDWORD)&BytesWritten, NULL)) { @@ -3486,7 +3486,7 @@ } #endif
-#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(FileHandle, InputBuffer, DataNode->Data.CompSize, (LPDWORD)&BytesWritten, NULL)) { @@ -3595,7 +3595,7 @@ return CAB_STATUS_SUCCESS; }
-#if !defined(WIN32) +#if !defined(_WIN32)
void CCabinet::ConvertDateAndTime(time_t* Time, PUSHORT DosDate, @@ -3626,7 +3626,7 @@ | (timedef->tm_hour << 11); }
-#endif // !WIN32 +#endif // !_WIN32
ULONG CCabinet::GetFileTimes(FILEHANDLE FileHandle, PCFFILE_NODE File) @@ -3639,7 +3639,7 @@ * Status of operation */ { -#if defined(WIN32) +#if defined(_WIN32) FILETIME FileTime;
if (GetFileTime(FileHandle, NULL, NULL, &FileTime)) @@ -3679,7 +3679,7 @@ * Status of operation */ { -#if defined(WIN32) +#if defined(_WIN32) LONG Attributes;
Attributes = GetFileAttributes(File->FileName); @@ -3734,7 +3734,7 @@ * Status of operation */ { -#if defined(WIN32) +#if defined(_WIN32) // 0x37 = READONLY | HIDDEN | SYSTEM | DIRECTORY | ARCHIVE // The IDs for these attributes are the same in the CAB file and under Windows // If the file has any other attributes, strip them off by the logical AND.
Modified: trunk/reactos/tools/cabman/cabinet.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/cabinet.h?rev=... ============================================================================== --- trunk/reactos/tools/cabman/cabinet.h [iso-8859-1] (original) +++ trunk/reactos/tools/cabman/cabinet.h [iso-8859-1] Sun Jun 26 22:17:01 2011 @@ -7,7 +7,7 @@
#pragma once
-#if defined(WIN32) +#if defined(_WIN32) #include <windows.h> #else #include <errno.h> @@ -25,7 +25,7 @@ #include <stdio.h> #include <string.h>
-#if defined(WIN32) +#if defined(_WIN32) #define DIR_SEPARATOR_CHAR '\' #define DIR_SEPARATOR_STRING "\"
@@ -431,7 +431,7 @@ ULONG GetAttributesOnFile(PCFFILE_NODE File); ULONG SetAttributesOnFile(char* FileName, USHORT FileAttributes); ULONG GetFileTimes(FILEHANDLE FileHandle, PCFFILE_NODE File); -#if !defined(WIN32) +#if !defined(_WIN32) void ConvertDateAndTime(time_t* Time, PUSHORT DosDate, PUSHORT DosTime); #endif #endif /* CAB_READ_ONLY */
Modified: trunk/reactos/tools/cabman/dfp.cxx URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/dfp.cxx?rev=52... ============================================================================== --- trunk/reactos/tools/cabman/dfp.cxx [iso-8859-1] (original) +++ trunk/reactos/tools/cabman/dfp.cxx [iso-8859-1] Sun Jun 26 22:17:01 2011 @@ -18,7 +18,7 @@ #include "dfp.h"
-#if defined(WIN32) +#if defined(_WIN32) #define GetSizeOfFile(handle) _GetSizeOfFile(handle) static LONG _GetSizeOfFile(FILEHANDLE handle) { @@ -126,7 +126,7 @@ char buf[MAX_PATH]; char eolbuf[2]; char* destpath; -#if defined(WIN32) +#if defined(_WIN32) ULONG BytesWritten; #endif
@@ -149,21 +149,21 @@ strcpy(buf, InfFileName);
/* Create .inf file, overwrite if it already exists */ -#if defined(WIN32) +#if defined(_WIN32) InfFileHandle = CreateFile(buf, // Create this file GENERIC_WRITE, // Open for writing 0, // No sharing NULL, // No security CREATE_ALWAYS, // Create or overwrite - FILE_ATTRIBUTE_NORMAL, // Normal file + FILE_ATTRIBUTE_NORMAL, // Normal file NULL); // No attribute template if (InfFileHandle == INVALID_HANDLE_VALUE) { DPRINT(MID_TRACE, ("Error creating '%u'.\n", (UINT)GetLastError())); return; } -#else /* !WIN32 */ - InfFileHandle = fopen(buf, "wb"); +#else /* !_WIN32 */ + InfFileHandle = fopen(buf, "wb"); if (InfFileHandle == NULL) { DPRINT(MID_TRACE, ("Error creating '%i'.\n", errno)); @@ -172,7 +172,7 @@ #endif }
-#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(InfFileHandle, InfLine, (DWORD)strlen(InfLine), (LPDWORD)&BytesWritten, NULL)) { DPRINT(MID_TRACE, ("ERROR WRITING '%u'.\n", (UINT)GetLastError())); @@ -186,7 +186,7 @@ eolbuf[0] = 0x0d; eolbuf[1] = 0x0a;
-#if defined(WIN32) +#if defined(_WIN32) if (!WriteFile(InfFileHandle, eolbuf, sizeof(eolbuf), (LPDWORD)&BytesWritten, NULL)) { DPRINT(MID_TRACE, ("ERROR WRITING '%u'.\n", (UINT)GetLastError())); @@ -215,7 +215,7 @@ return CAB_STATUS_SUCCESS;
/* Create cabinet file, overwrite if it already exists */ -#if defined(WIN32) +#if defined(_WIN32) FileHandle = CreateFile(FileName, // Create this file GENERIC_READ, // Open for reading 0, // No sharing @@ -225,8 +225,8 @@ NULL); // No attribute template if (FileHandle == INVALID_HANDLE_VALUE) return CAB_STATUS_CANNOT_OPEN; -#else /* !WIN32 */ - FileHandle = fopen(FileName, "rb"); +#else /* !_WIN32 */ + FileHandle = fopen(FileName, "rb"); if (FileHandle == NULL) return CAB_STATUS_CANNOT_OPEN; #endif @@ -1223,7 +1223,7 @@ } else printf("File does not exist: %s.\n", SrcName); - + break;
case CAB_STATUS_NOMEMORY:
Modified: trunk/reactos/tools/cdmake/cdmake.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/cdmake.c?rev=5... ============================================================================== --- trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] Sun Jun 26 22:17:01 2011 @@ -33,7 +33,7 @@ #include <stdarg.h> #include <stdlib.h> #include <string.h> -#ifdef WIN32 +#ifdef _WIN32 # include <io.h> # include <dos.h> #else @@ -46,11 +46,11 @@ # include <sys/types.h> # include <dirent.h> # include <unistd.h> -#endif // WIN32 +#endif // _WIN32 #include <ctype.h> #include <setjmp.h> #include <time.h> -#ifndef WIN32 +#ifndef _WIN32 #ifndef MAX_PATH #define MAX_PATH 260 #endif @@ -529,9 +529,9 @@ return c; }
-#if WIN32 +#if _WIN32 #define strcasecmp stricmp -#endif//WIN32 +#endif//_WIN32
/*----------------------------------------------------------------------------- This function checks to see if there's a cdname conflict. @@ -643,7 +643,7 @@ for the specified parent and returns a pointer to the new record. -----------------------------------------------------------------------------*/
-#if WIN32 +#if _WIN32
/* Win32 version */ PDIR_RECORD @@ -764,7 +764,7 @@ the specified root. It calls itself recursively to scan all subdirectories. -----------------------------------------------------------------------------*/
-#ifdef WIN32 +#ifdef _WIN32
static void make_directory_records (PDIR_RECORD d)