From 7cecaf25e8d91ab78a397de6bf546e80f5b6e27e Mon Sep 17 00:00:00 2001 From: Steven Edwards Date: Mon, 9 May 2005 01:46:57 +0000 Subject: [PATCH] strip whitespace from end of lines svn path=/trunk/; revision=15172 --- reactos/lib/kernel32/debug/break.c | 2 +- reactos/lib/kernel32/debug/output.c | 42 ++-- reactos/lib/kernel32/except/except.c | 18 +- reactos/lib/kernel32/file/bintype.c | 48 ++--- reactos/lib/kernel32/file/cnotify.c | 28 +-- reactos/lib/kernel32/file/copy.c | 4 +- reactos/lib/kernel32/file/create.c | 44 ++-- reactos/lib/kernel32/file/curdir.c | 8 +- reactos/lib/kernel32/file/delete.c | 2 +- reactos/lib/kernel32/file/deviceio.c | 14 +- reactos/lib/kernel32/file/dir.c | 70 +++--- reactos/lib/kernel32/file/file.c | 138 ++++++------ reactos/lib/kernel32/file/find.c | 14 +- reactos/lib/kernel32/file/hardlink.c | 38 ++-- reactos/lib/kernel32/file/iocompl.c | 28 +-- reactos/lib/kernel32/file/lfile.c | 6 +- reactos/lib/kernel32/file/lock.c | 52 ++--- reactos/lib/kernel32/file/mailslot.c | 38 ++-- reactos/lib/kernel32/file/move.c | 6 +- reactos/lib/kernel32/file/npipe.c | 84 ++++---- reactos/lib/kernel32/file/rw.c | 28 +-- reactos/lib/kernel32/file/volume.c | 30 +-- reactos/lib/kernel32/include/kernel32.h | 4 +- reactos/lib/kernel32/mem/global.c | 58 ++--- reactos/lib/kernel32/mem/isbad.c | 46 ++-- reactos/lib/kernel32/mem/local.c | 2 +- reactos/lib/kernel32/mem/procmem.c | 2 +- reactos/lib/kernel32/mem/resnotify.c | 6 +- reactos/lib/kernel32/mem/section.c | 4 +- reactos/lib/kernel32/misc/atom.c | 32 +-- reactos/lib/kernel32/misc/chartype.c | 2 +- reactos/lib/kernel32/misc/comm.c | 92 ++++---- reactos/lib/kernel32/misc/computername.c | 36 ++-- reactos/lib/kernel32/misc/console.c | 250 +++++++++++----------- reactos/lib/kernel32/misc/dllmain.c | 6 +- reactos/lib/kernel32/misc/errormsg.c | 4 +- reactos/lib/kernel32/misc/handle.c | 22 +- reactos/lib/kernel32/misc/lang.c | 24 +-- reactos/lib/kernel32/misc/lcformat.c | 4 +- reactos/lib/kernel32/misc/ldr.c | 30 +-- reactos/lib/kernel32/misc/lzexpand_main.c | 2 +- reactos/lib/kernel32/misc/nls.c | 44 ++-- reactos/lib/kernel32/misc/profile.c | 2 +- reactos/lib/kernel32/misc/stubs.c | 4 +- reactos/lib/kernel32/misc/sysinfo.c | 6 +- reactos/lib/kernel32/misc/time.c | 24 +-- reactos/lib/kernel32/misc/timerqueue.c | 88 ++++---- reactos/lib/kernel32/misc/toolhelp.c | 16 +- reactos/lib/kernel32/misc/version.c | 34 +-- reactos/lib/kernel32/process/cmdline.c | 6 +- reactos/lib/kernel32/process/create.c | 60 +++--- reactos/lib/kernel32/process/job.c | 38 ++-- reactos/lib/kernel32/process/proc.c | 36 ++-- reactos/lib/kernel32/process/session.c | 10 +- reactos/lib/kernel32/string/lstring.c | 18 +- reactos/lib/kernel32/synch/critical.c | 2 +- reactos/lib/kernel32/synch/intrlck.c | 50 ++--- reactos/lib/kernel32/synch/timer.c | 10 +- reactos/lib/kernel32/synch/wait.c | 2 +- reactos/lib/kernel32/thread/fiber.c | 4 +- reactos/lib/kernel32/thread/fls.c | 10 +- reactos/lib/kernel32/thread/thread.c | 24 +-- reactos/lib/kernel32/thread/tls.c | 10 +- 63 files changed, 933 insertions(+), 933 deletions(-) diff --git a/reactos/lib/kernel32/debug/break.c b/reactos/lib/kernel32/debug/break.c index e5717ff4d78..107869aae25 100644 --- a/reactos/lib/kernel32/debug/break.c +++ b/reactos/lib/kernel32/debug/break.c @@ -19,7 +19,7 @@ BOOL WINAPI DebugBreakProcess(HANDLE Process) { NTSTATUS nErrCode = DbgUiIssueRemoteBreakin(Process); - + if(!NT_SUCCESS(nErrCode)) { SetLastErrorByStatus(nErrCode); diff --git a/reactos/lib/kernel32/debug/output.c b/reactos/lib/kernel32/debug/output.c index 3394047c041..abe7cb6e008 100644 --- a/reactos/lib/kernel32/debug/output.c +++ b/reactos/lib/kernel32/debug/output.c @@ -25,7 +25,7 @@ HANDLE K32CreateDBMonMutex(void) PSID psidSystem = NULL; PSID psidAdministrators = NULL; PSID psidEveryone = NULL; - + /* buffer for the DACL */ PVOID pDaclBuf = NULL; @@ -42,7 +42,7 @@ HANDLE K32CreateDBMonMutex(void) /* security descriptor of the mutex */ SECURITY_DESCRIPTOR sdMutexSecurity; - + /* attributes of the mutex object we'll create */ SECURITY_ATTRIBUTES saMutexAttribs = { @@ -115,7 +115,7 @@ HANDLE K32CreateDBMonMutex(void) 0, &psidAdministrators ); - + /* failure */ if(!NT_SUCCESS(nErrCode)) __leave; @@ -134,7 +134,7 @@ HANDLE K32CreateDBMonMutex(void) 0, &psidEveryone ); - + /* failure */ if(!NT_SUCCESS(nErrCode)) __leave; @@ -193,7 +193,7 @@ HANDLE K32CreateDBMonMutex(void) /* create the security descriptor */ nErrCode = RtlCreateSecurityDescriptor - ( + ( &sdMutexSecurity, SECURITY_DESCRIPTOR_REVISION ); @@ -230,7 +230,7 @@ l_Cleanup: #if 0 } #endif - + return hMutex; } @@ -311,13 +311,13 @@ VOID WINAPI OutputDebugStringA(LPCSTR _OutputString) { /* synchronize with other invocations of OutputDebugString */ WaitForSingleObject(hDBMonMutex, INFINITE); - + /* buffer of the system-wide debug message monitor */ hDBMonBuffer = OpenFileMappingW(SECTION_MAP_WRITE, FALSE, L"DBWIN_BUFFER"); - + /* couldn't open the buffer: send the string to the kernel debugger */ if(hDBMonBuffer == NULL) break; - + /* map the buffer */ pDBMonBuffer = MapViewOfFile ( @@ -327,16 +327,16 @@ VOID WINAPI OutputDebugStringA(LPCSTR _OutputString) 0, 0 ); - + /* couldn't map the buffer: send the string to the kernel debugger */ if(pDBMonBuffer == NULL) break; - + /* open the event signaling that the buffer can be accessed */ hDBMonBufferReady = OpenEventW(SYNCHRONIZE, FALSE, L"DBWIN_BUFFER_READY"); - + /* couldn't open the event: send the string to the kernel debugger */ if(hDBMonBufferReady == NULL) break; - + /* open the event to be signaled when the buffer has been filled */ hDBMonDataReady = OpenEventW(EVENT_MODIFY_STATE, FALSE, L"DBWIN_DATA_READY"); @@ -395,13 +395,13 @@ VOID WINAPI OutputDebugStringA(LPCSTR _OutputString) nRoundLen = PAGE_SIZE - sizeof(DWORD) - 1; else nRoundLen = nOutputStringLen; - + /* copy the current block into the buffer */ memcpy(pDBMonBuffer->Buffer, _OutputString, nOutputStringLen); - + /* null-terminate the current block */ pDBMonBuffer->Buffer[nOutputStringLen] = 0; - + /* signal that the data contains meaningful data and can be read */ SetEvent(hDBMonDataReady); } @@ -410,19 +410,19 @@ VOID WINAPI OutputDebugStringA(LPCSTR _OutputString) { /* output in blocks of 512 characters */ CHAR a_cBuffer[512]; - + /* write a maximum of 511 bytes */ if(nOutputStringLen > (sizeof(a_cBuffer) - 1)) nRoundLen = sizeof(a_cBuffer) - 1; else nRoundLen = nOutputStringLen; - + /* copy the current block */ memcpy(a_cBuffer, _OutputString, nRoundLen); - + /* null-terminate the current block */ a_cBuffer[nRoundLen] = 0; - + /* send the current block to the kernel debugger */ DbgPrint("%s", a_cBuffer); } @@ -490,7 +490,7 @@ VOID WINAPI OutputDebugStringW(LPCWSTR _OutputString) { /* output the converted string */ OutputDebugStringA(strOut.Buffer); - + /* free the converted string */ RtlFreeAnsiString(&strOut); } diff --git a/reactos/lib/kernel32/except/except.c b/reactos/lib/kernel32/except/except.c index e1a46baeceb..00a7ef23d83 100644 --- a/reactos/lib/kernel32/except/except.c +++ b/reactos/lib/kernel32/except/except.c @@ -23,7 +23,7 @@ GetErrorMode(VOID) { NTSTATUS Status; UINT ErrMode; - + Status = NtQueryInformationProcess(NtCurrentProcess(), ProcessDefaultHardErrorMode, (PVOID)&ErrMode, @@ -34,22 +34,22 @@ GetErrorMode(VOID) SetLastErrorByStatus(Status); return 0; } - + return ErrMode; } /* * @implemented */ -UINT +UINT STDCALL SetErrorMode(UINT uMode) { UINT PrevErrMode; NTSTATUS Status; - + PrevErrMode = GetErrorMode(); - + Status = NtSetInformationProcess(NtCurrentProcess(), ProcessDefaultHardErrorMode, (PVOID)&uMode, @@ -83,7 +83,7 @@ SetUnhandledExceptionFilter( * The address can point to anywhere within the module. */ static const char* -_module_name_from_addr(const void* addr, void **module_start_addr, +_module_name_from_addr(const void* addr, void **module_start_addr, char* psz, size_t nChars) { MEMORY_BASIC_INFORMATION mbi; @@ -200,12 +200,12 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo) } /* - * Returning EXCEPTION_EXECUTE_HANDLER means that the code in + * Returning EXCEPTION_EXECUTE_HANDLER means that the code in * the __except block will be executed. Normally this will end up in a * Terminate process. */ - return EXCEPTION_EXECUTE_HANDLER; + return EXCEPTION_EXECUTE_HANDLER; } @@ -252,7 +252,7 @@ RaiseException ( { ExceptionRecord.NumberParameters = nNumberOfArguments; for ( nNumberOfArguments = 0; - (nNumberOfArguments < ExceptionRecord.NumberParameters); + (nNumberOfArguments < ExceptionRecord.NumberParameters); nNumberOfArguments ++ ) { diff --git a/reactos/lib/kernel32/file/bintype.c b/reactos/lib/kernel32/file/bintype.c index 48a5bde56d3..217f162595a 100644 --- a/reactos/lib/kernel32/file/bintype.c +++ b/reactos/lib/kernel32/file/bintype.c @@ -34,10 +34,10 @@ InternalIsOS2OrOldWin(HANDLE hFile, IMAGE_DOS_HEADER *mz, IMAGE_OS2_HEADER *ne) LPSTR nametab = NULL; DWORD Read, Ret; int i; - + Ret = BINARY_OS216; CurPos = SetFilePointer(hFile, 0, NULL, FILE_CURRENT); - + /* read modref table */ if((SetFilePointer(hFile, mz->e_lfanew + ne->ne_modtab, NULL, FILE_BEGIN) == -1) || (!(modtab = HeapAlloc(GetProcessHeap(), 0, ne->ne_cmod * sizeof(WORD)))) || @@ -46,7 +46,7 @@ InternalIsOS2OrOldWin(HANDLE hFile, IMAGE_DOS_HEADER *mz, IMAGE_OS2_HEADER *ne) { goto broken; } - + /* read imported names table */ if((SetFilePointer(hFile, mz->e_lfanew + ne->ne_imptab, NULL, FILE_BEGIN) == -1) || (!(nametab = HeapAlloc(GetProcessHeap(), 0, ne->ne_enttab - ne->ne_imptab))) || @@ -55,7 +55,7 @@ InternalIsOS2OrOldWin(HANDLE hFile, IMAGE_DOS_HEADER *mz, IMAGE_OS2_HEADER *ne) { goto broken; } - + for(i = 0; i < ne->ne_cmod; i++) { LPSTR module; @@ -67,10 +67,10 @@ InternalIsOS2OrOldWin(HANDLE hFile, IMAGE_DOS_HEADER *mz, IMAGE_OS2_HEADER *ne) goto done; } } - + broken: DPRINT("InternalIsOS2OrOldWin(): Binary file seems to be broken\n"); - + done: HeapFree(GetProcessHeap(), 0, modtab); HeapFree(GetProcessHeap(), 0, nametab); @@ -100,14 +100,14 @@ InternalGetBinaryType(HANDLE hFile) } Header; char magic[4]; DWORD Read; - + if((SetFilePointer(hFile, 0, NULL, FILE_BEGIN) == -1) || (!ReadFile(hFile, &Header, sizeof(Header), &Read, NULL) || (Read != sizeof(Header)))) { return BINARY_UNKNOWN; } - + if(!memcmp(Header.elf.magic, "\177ELF", sizeof(Header.elf.magic))) { /* FIXME: we don't bother to check byte order, architecture, etc. */ @@ -120,7 +120,7 @@ InternalGetBinaryType(HANDLE hFile) } return BINARY_UNKNOWN; } - + /* Mach-o File with Endian set to Big Endian or Little Endian*/ if(Header.macho.magic == 0xFEEDFACE || Header.macho.magic == 0xECAFDEEF) @@ -133,7 +133,7 @@ InternalGetBinaryType(HANDLE hFile) } return BINARY_UNKNOWN; } - + /* Not ELF, try DOS */ if(Header.mz.e_magic == IMAGE_DOS_SIGNATURE) { @@ -150,7 +150,7 @@ InternalGetBinaryType(HANDLE hFile) { return BINARY_DOS; } - + /* Reading the magic field succeeded so * we will try to determine what type it is. */ @@ -162,14 +162,14 @@ InternalGetBinaryType(HANDLE hFile) { return BINARY_DOS; } - + /* FIXME - detect 32/64 bit */ - + if(FileHeader.Characteristics & IMAGE_FILE_DLL) return BINARY_PE_DLL32; return BINARY_PE_EXE32; } - + if(!memcmp(magic, "NE", 1)) { /* This is a Windows executable (NE) header. This can @@ -185,7 +185,7 @@ InternalGetBinaryType(HANDLE hFile) /* Couldn't read header, so abort. */ return BINARY_DOS; } - + switch(ne.ne_exetyp) { case 2: @@ -213,29 +213,29 @@ GetBinaryTypeW ( { HANDLE hFile; DWORD BinType; - + if(!lpApplicationName || !lpBinaryType) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + hFile = CreateFileW(lpApplicationName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); if(hFile == INVALID_HANDLE_VALUE) { return FALSE; } - + BinType = InternalGetBinaryType(hFile); CloseHandle(hFile); - + switch(BinType) { case BINARY_UNKNOWN: { WCHAR *dot; - + /* * guess from filename */ @@ -288,7 +288,7 @@ GetBinaryTypeW ( return FALSE; } } - + DPRINT1("Invalid binary type returned!\n", BinType); return FALSE; } @@ -305,16 +305,16 @@ GetBinaryTypeA ( ) { PWCHAR ApplicationNameW; - + if(!lpApplicationName || !lpBinaryType) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + if (!(ApplicationNameW = FilenameA2W(lpApplicationName, FALSE))) return FALSE; - + return GetBinaryTypeW(ApplicationNameW, lpBinaryType); } diff --git a/reactos/lib/kernel32/file/cnotify.c b/reactos/lib/kernel32/file/cnotify.c index 2d9b45047e5..a29b1f2346a 100644 --- a/reactos/lib/kernel32/file/cnotify.c +++ b/reactos/lib/kernel32/file/cnotify.c @@ -26,7 +26,7 @@ FindCloseChangeNotification (HANDLE hChangeHandle) SetLastErrorByStatus(Status); return FALSE; } - + return TRUE; } @@ -101,15 +101,15 @@ FindFirstChangeNotificationW ( - /* FIXME: We free the string alloced by RtlDosPathNameToNtPathName_U, but what + /* FIXME: We free the string alloced by RtlDosPathNameToNtPathName_U, but what * about the special case where the user can pass a \\?\ path? We must not free * the users buffer!. But should we even call RtlDosPathNameToNtPathName_U in that * case??? -Gunnar */ RtlFreeUnicodeString( &NtPathU); - - + + if (!NT_SUCCESS(Status)) { @@ -156,9 +156,9 @@ FindNextChangeNotification ( NULL,//Buffer, 0,//BufferLength, FILE_NOTIFY_CHANGE_SECURITY,//meaningless/ignored for subsequent calls, but must contain a valid flag - 0 //meaningless/ignored for subsequent calls + 0 //meaningless/ignored for subsequent calls ); - + if (!NT_SUCCESS(Status)) { SetLastErrorByStatus(Status); @@ -170,8 +170,8 @@ FindNextChangeNotification ( extern VOID STDCALL -(ApcRoutine)(PVOID ApcContext, - struct _IO_STATUS_BLOCK* IoStatusBlock, +(ApcRoutine)(PVOID ApcContext, + struct _IO_STATUS_BLOCK* IoStatusBlock, ULONG Reserved); @@ -193,10 +193,10 @@ ReadDirectoryChangesW( { NTSTATUS Status; IO_STATUS_BLOCK IoStatus; - + if (lpOverlapped ) lpOverlapped->Internal = STATUS_PENDING; - + Status = NtNotifyChangeDirectoryFile( hDirectory, lpOverlapped ? lpOverlapped->hEvent : NULL, @@ -207,18 +207,18 @@ ReadDirectoryChangesW( nBufferLength, dwNotifyFilter, bWatchSubtree - ); - + ); + if (!NT_SUCCESS(Status)) { SetLastErrorByStatus(Status); return FALSE; } - + /* NOTE: lpBytesReturned is undefined for asynch. operations */ *lpBytesReturned = IoStatus.Information; - + return TRUE; } diff --git a/reactos/lib/kernel32/file/copy.c b/reactos/lib/kernel32/file/copy.c index f998feb3d12..98188a95fa1 100644 --- a/reactos/lib/kernel32/file/copy.c +++ b/reactos/lib/kernel32/file/copy.c @@ -7,7 +7,7 @@ * PROGRAMMER: Ariadne (ariadne@xs4all.nl) * UPDATE HISTORY: * 01/11/98 Created - * 07/02/99 Moved to seperate file + * 07/02/99 Moved to seperate file */ /* INCLUDES ****************************************************************/ @@ -53,7 +53,7 @@ CopyLoop ( { BytesCopied.QuadPart = 0; EndOfFileFound = FALSE; - CallbackReason = CALLBACK_STREAM_SWITCH; + CallbackReason = CALLBACK_STREAM_SWITCH; while (! EndOfFileFound && NT_SUCCESS(errCode) && (NULL == pbCancel || ! *pbCancel)) diff --git a/reactos/lib/kernel32/file/create.c b/reactos/lib/kernel32/file/create.c index 67ccd9bf4c9..9225bdba369 100644 --- a/reactos/lib/kernel32/file/create.c +++ b/reactos/lib/kernel32/file/create.c @@ -36,9 +36,9 @@ HANDLE STDCALL CreateFileA (LPCSTR lpFileName, { PWCHAR FileNameW; HANDLE FileHandle; - + DPRINT("CreateFileA(lpFileName %s)\n",lpFileName); - + if (!(FileNameW = FilenameA2W(lpFileName, FALSE))) return INVALID_HANDLE_VALUE; @@ -49,7 +49,7 @@ HANDLE STDCALL CreateFileA (LPCSTR lpFileName, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); - + return FileHandle; } @@ -84,15 +84,15 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, case CREATE_NEW: dwCreationDisposition = FILE_CREATE; break; - + case CREATE_ALWAYS: dwCreationDisposition = FILE_OVERWRITE_IF; break; - + case OPEN_EXISTING: dwCreationDisposition = FILE_OPEN; break; - + case OPEN_ALWAYS: dwCreationDisposition = FILE_OPEN_IF; break; @@ -100,7 +100,7 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, case TRUNCATE_EXISTING: dwCreationDisposition = FILE_OVERWRITE; break; - + default: SetLastError(ERROR_INVALID_PARAMETER); return (INVALID_HANDLE_VALUE); @@ -116,7 +116,7 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, SetLastError(ERROR_PATH_NOT_FOUND); return INVALID_HANDLE_VALUE; } - + DPRINT("NtPathU \'%S\'\n", NtPathU.Buffer); /* validate & translate the flags */ @@ -128,7 +128,7 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, while waiting for file io to complete */ Flags |= FILE_SYNCHRONOUS_IO_NONALERT; } - + if(dwFlagsAndAttributes & FILE_FLAG_WRITE_THROUGH) Flags |= FILE_WRITE_THROUGH; @@ -137,13 +137,13 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, if(dwFlagsAndAttributes & FILE_FLAG_RANDOM_ACCESS) Flags |= FILE_RANDOM_ACCESS; - + if(dwFlagsAndAttributes & FILE_FLAG_SEQUENTIAL_SCAN) Flags |= FILE_SEQUENTIAL_ONLY; - + if(dwFlagsAndAttributes & FILE_FLAG_DELETE_ON_CLOSE) Flags |= FILE_DELETE_ON_CLOSE; - + if(dwFlagsAndAttributes & FILE_FLAG_BACKUP_SEMANTICS) { if(dwDesiredAccess & GENERIC_ALL) @@ -167,7 +167,7 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, Flags |= FILE_OPEN_NO_RECALL; FileAttributes = (dwFlagsAndAttributes & (FILE_ATTRIBUTE_VALID_FLAGS & ~FILE_ATTRIBUTE_DIRECTORY)); - + /* handle may allways be waited on and querying attributes are allways allowed */ dwDesiredAccess |= SYNCHRONIZE | FILE_READ_ATTRIBUTES; @@ -212,7 +212,7 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, return Reply.Data.GetInputHandleReply.InputHandle; } } - + if (hTemplateFile != NULL) { FILE_EA_INFORMATION EaInformation; @@ -239,7 +239,7 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, SetLastError(ERROR_NOT_ENOUGH_MEMORY); return INVALID_HANDLE_VALUE; } - + Status = NtQueryEaFile(hTemplateFile, &IoStatusBlock, EaBuffer, @@ -249,7 +249,7 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, 0, NULL, TRUE); - + if (NT_SUCCESS(Status)) { /* we successfully read the extended attributes, break the loop @@ -263,7 +263,7 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, 0, EaBuffer); EaBuffer = NULL; - + if (Status != STATUS_BUFFER_TOO_SMALL) { /* unless we just allocated not enough memory, break the loop @@ -296,7 +296,7 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, ObjectAttributes.SecurityDescriptor = lpSecurityAttributes->lpSecurityDescriptor; } - + if(!(dwFlagsAndAttributes & FILE_FLAG_POSIX_SEMANTICS)) ObjectAttributes.Attributes |= OBJ_CASE_INSENSITIVE; @@ -314,7 +314,7 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, EaLength); RtlFreeUnicodeString(&NtPathU); - + /* free the extended attributes buffer if allocated */ if (EaBuffer != NULL) { @@ -340,14 +340,14 @@ HANDLE STDCALL CreateFileW (LPCWSTR lpFileName, { SetLastErrorByStatus (Status); } - + return INVALID_HANDLE_VALUE; } - + /* create with OPEN_ALWAYS (FILE_OPEN_IF) returns info = FILE_OPENED or FILE_CREATED create with CREATE_ALWAYS (FILE_OVERWRITE_IF) returns info = FILE_OVERWRITTEN or FILE_CREATED - */ + */ if (dwCreationDisposition == FILE_OPEN_IF) { SetLastError(IoStatusBlock.Information == FILE_OPENED ? ERROR_ALREADY_EXISTS : 0); diff --git a/reactos/lib/kernel32/file/curdir.c b/reactos/lib/kernel32/file/curdir.c index ae6e2369c8e..7859ec55563 100644 --- a/reactos/lib/kernel32/file/curdir.c +++ b/reactos/lib/kernel32/file/curdir.c @@ -49,7 +49,7 @@ GetCurrentDirectoryA ( SetLastError(ERROR_FILENAME_EXCED_RANGE); return 0; } - + return FilenameW2A_FitOrFail(lpBuffer, nBufferLength, BufferW, ret+1); } @@ -123,7 +123,7 @@ SetCurrentDirectoryW ( /* * @implemented * - * NOTE: Windows returns a dos/short (8.3) path + * NOTE: Windows returns a dos/short (8.3) path */ DWORD STDCALL @@ -221,7 +221,7 @@ GetSystemDirectoryA ( UINT uSize ) { - return FilenameU2A_FitOrFail(lpBuffer, uSize, &SystemDirectory); + return FilenameU2A_FitOrFail(lpBuffer, uSize, &SystemDirectory); } @@ -264,7 +264,7 @@ GetWindowsDirectoryA ( UINT uSize ) { - return FilenameU2A_FitOrFail(lpBuffer, uSize, &WindowsDirectory); + return FilenameU2A_FitOrFail(lpBuffer, uSize, &WindowsDirectory); } diff --git a/reactos/lib/kernel32/file/delete.c b/reactos/lib/kernel32/file/delete.c index 06b88f1ff00..b7d182bf82f 100644 --- a/reactos/lib/kernel32/file/delete.c +++ b/reactos/lib/kernel32/file/delete.c @@ -29,7 +29,7 @@ DeleteFileA ( ) { PWCHAR FileNameW; - + if (!(FileNameW = FilenameA2W(lpFileName, FALSE))) return FALSE; diff --git a/reactos/lib/kernel32/file/deviceio.c b/reactos/lib/kernel32/file/deviceio.c index 6b05a896685..03e21d0157a 100644 --- a/reactos/lib/kernel32/file/deviceio.c +++ b/reactos/lib/kernel32/file/deviceio.c @@ -31,7 +31,7 @@ DeviceIoControl(IN HANDLE hDevice, { BOOL FsIoCtl; NTSTATUS Status; - + FsIoCtl = ((dwIoControlCode >> 16) == FILE_DEVICE_FILE_SYSTEM); if (lpBytesReturned != NULL) @@ -42,7 +42,7 @@ DeviceIoControl(IN HANDLE hDevice, if (lpOverlapped != NULL) { PVOID ApcContext; - + lpOverlapped->Internal = STATUS_PENDING; ApcContext = (((ULONG_PTR)lpOverlapped->hEvent & 0x1) ? NULL : lpOverlapped); @@ -88,7 +88,7 @@ DeviceIoControl(IN HANDLE hDevice, else { IO_STATUS_BLOCK Iosb; - + if (FsIoCtl) { Status = NtFsControlFile(hDevice, @@ -165,18 +165,18 @@ GetOverlappedResult ( { if (!bWait) { - /* can't use SetLastErrorByStatus(STATUS_PENDING) here, + /* can't use SetLastErrorByStatus(STATUS_PENDING) here, since STATUS_PENDING translates to ERROR_IO_PENDING */ SetLastError(ERROR_IO_INCOMPLETE); return FALSE; } - + hObject = lpOverlapped->hEvent ? lpOverlapped->hEvent : hFile; /* Wine delivers pending APC's while waiting, but Windows does not, nor do we... */ WaitStatus = WaitForSingleObject(hObject, INFINITE); - + if (WaitStatus == WAIT_FAILED) { DPRINT("Wait failed!\n"); @@ -186,7 +186,7 @@ GetOverlappedResult ( } *lpNumberOfBytesTransferred = lpOverlapped->InternalHigh; - + if (!NT_SUCCESS(lpOverlapped->Internal)) { SetLastErrorByStatus(lpOverlapped->Internal); diff --git a/reactos/lib/kernel32/file/dir.c b/reactos/lib/kernel32/file/dir.c index f7d60b5bbbf..7287134a847 100644 --- a/reactos/lib/kernel32/file/dir.c +++ b/reactos/lib/kernel32/file/dir.c @@ -35,7 +35,7 @@ CreateDirectoryA ( ) { PWCHAR PathNameW; - + if (!(PathNameW = FilenameA2W(lpPathName, FALSE))) return FALSE; @@ -60,7 +60,7 @@ CreateDirectoryExA ( if (!(TemplateDirectoryW = FilenameA2W(lpTemplateDirectory, TRUE))) return FALSE; - + if (!(NewDirectoryW = FilenameA2W(lpNewDirectory, FALSE))) { RtlFreeHeap (RtlGetProcessHeap (), @@ -68,7 +68,7 @@ CreateDirectoryExA ( TemplateDirectoryW); return FALSE; } - + ret = CreateDirectoryExW (TemplateDirectoryW, NewDirectoryW, lpSecurityAttributes); @@ -178,7 +178,7 @@ CreateDirectoryExW ( SetLastError(ERROR_PATH_NOT_FOUND); return FALSE; } - + InitializeObjectAttributes(&ObjectAttributes, &NtTemplatePathU, OBJ_CASE_INSENSITIVE, @@ -204,7 +204,7 @@ CreateDirectoryExW ( SetLastErrorByStatus (Status); return FALSE; } - + for (;;) { Status = NtQueryInformationFile(TemplateHandle, @@ -222,7 +222,7 @@ CreateDirectoryExW ( Status = STATUS_INSUFFICIENT_RESOURCES; break; } - + Status = NtQueryEaFile(TemplateHandle, &IoStatusBlock, EaBuffer, @@ -260,13 +260,13 @@ CreateDirectoryExW ( break; } } - + NtClose(TemplateHandle); - + RtlFreeHeap (RtlGetProcessHeap (), 0, NtTemplatePathU.Buffer); - + if (!NT_SUCCESS(Status)) { /* free the he extended attributes buffer */ @@ -298,7 +298,7 @@ CreateDirectoryExW ( 0, EaBuffer); } - + SetLastError(ERROR_PATH_NOT_FOUND); return FALSE; } @@ -355,7 +355,7 @@ RemoveDirectoryA ( ) { PWCHAR PathNameW; - + DPRINT("RemoveDirectoryA(%s)\n",lpPathName); if (!(PathNameW = FilenameA2W(lpPathName, FALSE))) @@ -428,7 +428,7 @@ RemoveDirectoryW ( sizeof(FILE_DISPOSITION_INFORMATION), FileDispositionInformation); NtClose(DirectoryHandle); - + if (!NT_SUCCESS(Status)) { SetLastErrorByStatus (Status); @@ -469,27 +469,27 @@ GetFullPathNameA ( return 0; ret = GetFullPathNameW(FileNameW, MAX_PATH, BufferW, &FilePartW); - + if (!ret) return 0; - + if (ret > MAX_PATH) { SetLastError(ERROR_FILENAME_EXCED_RANGE); return 0; } - + ret = FilenameW2A_FitOrFail(lpBuffer, nBufferLength, BufferW, ret+1); - + if (ret < nBufferLength && lpFilePart) { /* if the path closed with '\', FilePart is NULL */ - if (!FilePartW) + if (!FilePartW) *lpFilePart=NULL; else *lpFilePart = (FilePartW - BufferW) + lpBuffer; } - + DPRINT("GetFullPathNameA ret: lpBuffer %s lpFilePart %s\n", lpBuffer, (lpFilePart == NULL) ? "NULL" : *lpFilePart); @@ -555,13 +555,13 @@ GetShortPathNameA ( if (!ret) return 0; - + if (ret > MAX_PATH) { SetLastError(ERROR_FILENAME_EXCED_RANGE); return 0; } - + return FilenameW2A_FitOrFail(shortpath, shortlen, ShortPathW, ret+1); } @@ -861,7 +861,7 @@ SearchPathW ( } else { - Name = RtlAllocateHeap(GetProcessHeap(), + Name = RtlAllocateHeap(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, (wcslen(lpFileName) + wcslen(lpExtension) + 1) * sizeof(WCHAR)); @@ -965,9 +965,9 @@ SetDllDirectoryW( ) { UNICODE_STRING PathName; - + RtlInitUnicodeString(&PathName, lpPathName); - + RtlEnterCriticalSection(&DllLock); if(PathName.Length > 0) { @@ -988,7 +988,7 @@ SetDllDirectoryW( } DllDirectory.Length = 0; DllDirectory.MaximumLength = PathName.Length + sizeof(WCHAR); - + RtlCopyUnicodeString(&DllDirectory, &PathName); } } @@ -1011,13 +1011,13 @@ SetDllDirectoryA( ) { PWCHAR PathNameW=NULL; - + if(lpPathName) { if (!(PathNameW = FilenameA2W(lpPathName, FALSE))) return FALSE; } - + return SetDllDirectoryW(PathNameW); } @@ -1032,7 +1032,7 @@ GetDllDirectoryW( ) { DWORD Ret; - + RtlEnterCriticalSection(&DllLock); if(nBufferLength > 0) { @@ -1041,7 +1041,7 @@ GetDllDirectoryW( { Ret = nBufferLength - 1; } - + if(Ret > 0) { RtlCopyMemory(lpBuffer, DllDirectory.Buffer, Ret * sizeof(WCHAR)); @@ -1054,7 +1054,7 @@ GetDllDirectoryW( Ret = (DllDirectory.Length / sizeof(WCHAR)) + 1; } RtlLeaveCriticalSection(&DllLock); - + return Ret; } @@ -1075,13 +1075,13 @@ GetDllDirectoryA( if (!ret) return 0; - + if (ret > MAX_PATH) { SetLastError(ERROR_FILENAME_EXCED_RANGE); return 0; } - + return FilenameW2A_FitOrFail(lpBuffer, nBufferLength, BufferW, ret+1); } @@ -1105,10 +1105,10 @@ BOOL STDCALL NeedCurrentDirectoryForExePathA(LPCSTR ExeName) { PWCHAR ExeNameW; - + if (!(ExeNameW = FilenameA2W(ExeName, FALSE))) - return FALSE; - + return FALSE; + return NeedCurrentDirectoryForExePathW(ExeNameW); } @@ -1244,7 +1244,7 @@ DWORD STDCALL GetLongPathNameA( LPCSTR shortpath, LPSTR longpath, DWORD longlen SetLastError(ERROR_FILENAME_EXCED_RANGE); return 0; } - + return FilenameW2A_FitOrFail(longpath, longlen, longpathW, ret+1 ); } diff --git a/reactos/lib/kernel32/file/file.c b/reactos/lib/kernel32/file/file.c index 3768245bf7f..ce88c0c9d81 100644 --- a/reactos/lib/kernel32/file/file.c +++ b/reactos/lib/kernel32/file/file.c @@ -53,7 +53,7 @@ FilenameA2W(LPCSTR NameA, BOOL alloc) SetLastError( ERROR_FILENAME_EXCED_RANGE ); else SetLastErrorByStatus(Status); - + return NULL; } @@ -65,7 +65,7 @@ Returns: Success: number of TCHARS copied into dest. buffer NOT including nullterm Fail: size of buffer in TCHARS required to hold the converted filename, including nullterm */ -DWORD +DWORD FilenameU2A_FitOrFail( LPSTR DestA, INT destLen, /* buffer size in TCHARS incl. nullchar */ @@ -76,23 +76,23 @@ FilenameU2A_FitOrFail( ret = bIsFileApiAnsi? RtlUnicodeStringToAnsiSize(SourceU) : RtlUnicodeStringToOemSize(SourceU); /* ret incl. nullchar */ - + if (DestA && ret <= destLen) { ANSI_STRING str; - + str.Buffer = DestA; str.MaximumLength = destLen; - - + + if (bIsFileApiAnsi) RtlUnicodeStringToAnsiString(&str, SourceU, FALSE ); else RtlUnicodeStringToOemString(&str, SourceU, FALSE ); - + ret = str.Length; /* SUCCESS: length without terminating 0 */ } - + return ret; } @@ -104,7 +104,7 @@ Returns: Success: number of TCHARS copied into dest. buffer NOT including nullterm Fail: size of buffer in TCHARS required to hold the converted filename, including nullterm */ -DWORD +DWORD FilenameW2A_FitOrFail( LPSTR DestA, INT destLen, /* buffer size in TCHARS incl. nullchar */ @@ -120,57 +120,57 @@ FilenameW2A_FitOrFail( strW.MaximumLength = sourceLen * sizeof(WCHAR); strW.Length = strW.MaximumLength - sizeof(WCHAR); - return FilenameU2A_FitOrFail(DestA, destLen, &strW); + return FilenameU2A_FitOrFail(DestA, destLen, &strW); } /* Return: num. TCHARS copied into dest including nullterm */ -DWORD -FilenameA2W_N( - LPWSTR dest, +DWORD +FilenameA2W_N( + LPWSTR dest, INT destlen, /* buffer size in TCHARS incl. nullchar */ - LPCSTR src, + LPCSTR src, INT srclen /* buffer size in TCHARS incl. nullchar */ ) { DWORD ret; if (srclen < 0) srclen = strlen( src ) + 1; - + if (bIsFileApiAnsi) - RtlMultiByteToUnicodeN( dest, destlen* sizeof(WCHAR), &ret, (LPSTR)src, srclen ); + RtlMultiByteToUnicodeN( dest, destlen* sizeof(WCHAR), &ret, (LPSTR)src, srclen ); else RtlOemToUnicodeN( dest, destlen* sizeof(WCHAR), &ret, (LPSTR)src, srclen ); - + if (ret) dest[(ret/sizeof(WCHAR))-1]=0; - + return ret/sizeof(WCHAR); } /* Return: num. TCHARS copied into dest including nullterm */ -DWORD -FilenameW2A_N( - LPSTR dest, +DWORD +FilenameW2A_N( + LPSTR dest, INT destlen, /* buffer size in TCHARS incl. nullchar */ - LPCWSTR src, + LPCWSTR src, INT srclen /* buffer size in TCHARS incl. nullchar */ ) { DWORD ret; if (srclen < 0) srclen = wcslen( src ) + 1; - + if (bIsFileApiAnsi) RtlUnicodeToMultiByteN( dest, destlen, &ret, (LPWSTR) src, srclen * sizeof(WCHAR)); else - RtlUnicodeToOemN( dest, destlen, &ret, (LPWSTR) src, srclen * sizeof(WCHAR) ); - + RtlUnicodeToOemN( dest, destlen, &ret, (LPWSTR) src, srclen * sizeof(WCHAR) ); + if (ret) dest[ret-1]=0; - + return ret; } @@ -260,7 +260,7 @@ OpenFile(LPCSTR lpFileName, RtlAnsiStringToUnicodeString (&FileNameU, &FileName, TRUE); else RtlOemStringToUnicodeString (&FileNameU, &FileName, TRUE); - + Len = SearchPathW (NULL, FileNameU.Buffer, NULL, @@ -371,7 +371,7 @@ SetFilePointer(HANDLE hFile, NTSTATUS errCode; IO_STATUS_BLOCK IoStatusBlock; LARGE_INTEGER Distance; - + DPRINT("SetFilePointer(hFile %x, lDistanceToMove %d, dwMoveMethod %d)\n", hFile,lDistanceToMove,dwMoveMethod); @@ -394,7 +394,7 @@ SetFilePointer(HANDLE hFile, { Distance.u.HighPart = -1; } - + switch(dwMoveMethod) { case FILE_CURRENT: @@ -421,13 +421,13 @@ SetFilePointer(HANDLE hFile, SetLastError(ERROR_INVALID_PARAMETER); return -1; } - + if(FilePosition.CurrentByteOffset.QuadPart < 0) { SetLastError(ERROR_NEGATIVE_SEEK); return -1; } - + errCode = NtSetInformationFile(hFile, &IoStatusBlock, &FilePosition, @@ -438,7 +438,7 @@ SetFilePointer(HANDLE hFile, SetLastErrorByStatus(errCode); return -1; } - + if (lpDistanceToMoveHigh != NULL) { *lpDistanceToMoveHigh = FilePosition.CurrentByteOffset.u.HighPart; @@ -494,13 +494,13 @@ SetFilePointerEx(HANDLE hFile, SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + if(FilePosition.CurrentByteOffset.QuadPart < 0) { SetLastError(ERROR_NEGATIVE_SEEK); return FALSE; } - + errCode = NtSetInformationFile(hFile, &IoStatusBlock, &FilePosition, @@ -511,7 +511,7 @@ SetFilePointerEx(HANDLE hFile, SetLastErrorByStatus(errCode); return FALSE; } - + if (lpNewFilePointer) { *lpNewFilePointer = FilePosition.CurrentByteOffset; @@ -688,7 +688,7 @@ GetCompressedFileSizeW(LPCWSTR lpFileName, NTSTATUS errCode; IO_STATUS_BLOCK IoStatusBlock; HANDLE hFile; - + hFile = CreateFileW(lpFileName, GENERIC_READ, FILE_SHARE_READ, @@ -696,7 +696,7 @@ GetCompressedFileSizeW(LPCWSTR lpFileName, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - + if (hFile == INVALID_HANDLE_VALUE) return INVALID_FILE_SIZE; @@ -760,13 +760,13 @@ GetFileInformationByHandle(HANDLE hFile, } lpFileInformation->dwFileAttributes = (DWORD)FileBasic.FileAttributes; - + lpFileInformation->ftCreationTime.dwHighDateTime = FileBasic.CreationTime.u.HighPart; lpFileInformation->ftCreationTime.dwLowDateTime = FileBasic.CreationTime.u.LowPart; lpFileInformation->ftLastAccessTime.dwHighDateTime = FileBasic.LastAccessTime.u.HighPart; lpFileInformation->ftLastAccessTime.dwLowDateTime = FileBasic.LastAccessTime.u.LowPart; - + lpFileInformation->ftLastWriteTime.dwHighDateTime = FileBasic.LastWriteTime.u.HighPart; lpFileInformation->ftLastWriteTime.dwLowDateTime = FileBasic.LastWriteTime.u.LowPart; @@ -820,8 +820,8 @@ GetFileInformationByHandle(HANDLE hFile, * @implemented */ BOOL STDCALL -GetFileAttributesExW(LPCWSTR lpFileName, - GET_FILEEX_INFO_LEVELS fInfoLevelId, +GetFileAttributesExW(LPCWSTR lpFileName, + GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation) { FILE_NETWORK_OPEN_INFORMATION FileInformation; @@ -908,11 +908,11 @@ GetFileAttributesExW(LPCWSTR lpFileName, */ BOOL STDCALL GetFileAttributesExA(LPCSTR lpFileName, - GET_FILEEX_INFO_LEVELS fInfoLevelId, + GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation) { PWCHAR FileNameW; - + if (!(FileNameW = FilenameA2W(lpFileName, FALSE))) return FALSE; @@ -932,7 +932,7 @@ GetFileAttributesA(LPCSTR lpFileName) if (!(FileNameW = FilenameA2W(lpFileName, FALSE))) return INVALID_FILE_ATTRIBUTES; - + ret = GetFileAttributesExW(FileNameW, GetFileExInfoStandard, &FileAttributeData); return ret ? FileAttributeData.dwFileAttributes : INVALID_FILE_ATTRIBUTES; @@ -1061,18 +1061,18 @@ UINT WINAPI GetTempFileNameA( LPCSTR path, LPCSTR prefix, UINT unique, LPSTR buf PWCHAR PathW; WCHAR PrefixW[3+1]; UINT ret; - + if (!(PathW = FilenameA2W(path, FALSE))) return 0; - + if (prefix) FilenameA2W_N(PrefixW, 3+1, prefix, -1); - + ret = GetTempFileNameW(PathW, prefix ? PrefixW : NULL, unique, BufferW); - + if (ret) FilenameW2A_N(buffer, MAX_PATH, BufferW, -1); - + return ret; } @@ -1227,7 +1227,7 @@ SetFileTime(HANDLE hFile, SetLastErrorByStatus(Status); return FALSE; } - + return TRUE; } @@ -1269,10 +1269,10 @@ SetEndOfFile(HANDLE hFile) EndOfFileInfo.EndOfFile.QuadPart = FilePosInfo.CurrentByteOffset.QuadPart; /* - NOTE: + NOTE: This call is not supposed to free up any space after the eof marker if the file gets truncated. We have to deallocate the space explicitly afterwards. - But...most file systems dispatch both FileEndOfFileInformation + But...most file systems dispatch both FileEndOfFileInformation and FileAllocationInformation as they were the same command. */ @@ -1304,7 +1304,7 @@ SetEndOfFile(HANDLE hFile) SetLastErrorByStatus(Status); return FALSE; } - + return TRUE; } @@ -1323,9 +1323,9 @@ SetFileValidData( IO_STATUS_BLOCK IoStatusBlock; FILE_VALID_DATA_LENGTH_INFORMATION ValidDataLengthInformation; NTSTATUS Status; - + ValidDataLengthInformation.ValidDataLength.QuadPart = ValidDataLength; - + Status = NtSetInformationFile( hFile, &IoStatusBlock, //out @@ -1333,12 +1333,12 @@ SetFileValidData( sizeof(FILE_VALID_DATA_LENGTH_INFORMATION), FileValidDataLengthInformation ); - + if (!NT_SUCCESS(Status)){ SetLastErrorByStatus(Status); return FALSE; } - + return TRUE; } @@ -1358,44 +1358,44 @@ SetFileShortNameW( UNICODE_STRING ShortName; IO_STATUS_BLOCK IoStatusBlock; PFILE_NAME_INFORMATION FileNameInformation; - + if(IsConsoleHandle(hFile)) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } - + if(!lpShortName) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + RtlInitUnicodeString(&ShortName, lpShortName); - + NeededSize = sizeof(FILE_NAME_INFORMATION) + ShortName.Length + sizeof(WCHAR); if(!(FileNameInformation = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, NeededSize))) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } - + FileNameInformation->FileNameLength = ShortName.Length; RtlCopyMemory(FileNameInformation->FileName, ShortName.Buffer, ShortName.Length); - + Status = NtSetInformationFile(hFile, &IoStatusBlock, //out FileNameInformation, NeededSize, FileShortNameInformation); - + RtlFreeHeap(RtlGetProcessHeap(), 0, FileNameInformation); if(!NT_SUCCESS(Status)) { - + SetLastErrorByStatus(Status); } - + return NT_SUCCESS(Status); } @@ -1411,19 +1411,19 @@ SetFileShortNameA( ) { PWCHAR ShortNameW; - + if(IsConsoleHandle(hFile)) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } - + if(!lpShortName) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + if (!(ShortNameW = FilenameA2W(lpShortName, FALSE))) return FALSE; diff --git a/reactos/lib/kernel32/file/find.c b/reactos/lib/kernel32/file/find.c index 3ccc8564150..636e5eec437 100644 --- a/reactos/lib/kernel32/file/find.c +++ b/reactos/lib/kernel32/file/find.c @@ -351,13 +351,13 @@ FindFirstFileA ( /* copy data into WIN32_FIND_DATA structure */ lpFindFileData->dwFileAttributes = IData->pFileInfo->FileAttributes; - + lpFindFileData->ftCreationTime.dwHighDateTime = IData->pFileInfo->CreationTime.u.HighPart; lpFindFileData->ftCreationTime.dwLowDateTime = IData->pFileInfo->CreationTime.u.LowPart; - + lpFindFileData->ftLastAccessTime.dwHighDateTime = IData->pFileInfo->LastAccessTime.u.HighPart; lpFindFileData->ftLastAccessTime.dwLowDateTime = IData->pFileInfo->LastAccessTime.u.LowPart; - + lpFindFileData->ftLastWriteTime.dwHighDateTime = IData->pFileInfo->LastWriteTime.u.HighPart; lpFindFileData->ftLastWriteTime.dwLowDateTime = IData->pFileInfo->LastWriteTime.u.LowPart; @@ -439,7 +439,7 @@ FindNextFileA ( /* copy data into WIN32_FIND_DATA structure */ lpFindFileData->dwFileAttributes = IData->pFileInfo->FileAttributes; - + lpFindFileData->ftCreationTime.dwHighDateTime = IData->pFileInfo->CreationTime.u.HighPart; lpFindFileData->ftCreationTime.dwLowDateTime = IData->pFileInfo->CreationTime.u.LowPart; @@ -544,7 +544,7 @@ FindFirstFileW ( /* copy data into WIN32_FIND_DATA structure */ lpFindFileData->dwFileAttributes = IData->pFileInfo->FileAttributes; - + lpFindFileData->ftCreationTime.dwHighDateTime = IData->pFileInfo->CreationTime.u.HighPart; lpFindFileData->ftCreationTime.dwLowDateTime = IData->pFileInfo->CreationTime.u.LowPart; @@ -553,10 +553,10 @@ FindFirstFileW ( lpFindFileData->ftLastWriteTime.dwHighDateTime = IData->pFileInfo->LastWriteTime.u.HighPart; lpFindFileData->ftLastWriteTime.dwLowDateTime = IData->pFileInfo->LastWriteTime.u.LowPart; - + lpFindFileData->nFileSizeHigh = IData->pFileInfo->EndOfFile.u.HighPart; lpFindFileData->nFileSizeLow = IData->pFileInfo->EndOfFile.u.LowPart; - + memcpy (lpFindFileData->cFileName, IData->pFileInfo->FileName, IData->pFileInfo->FileNameLength); diff --git a/reactos/lib/kernel32/file/hardlink.c b/reactos/lib/kernel32/file/hardlink.c index 984a2dd6454..445ee4e699b 100644 --- a/reactos/lib/kernel32/file/hardlink.c +++ b/reactos/lib/kernel32/file/hardlink.c @@ -34,15 +34,15 @@ CreateHardLinkW(LPCWSTR lpFileName, IO_STATUS_BLOCK IoStatus; NTSTATUS Status; BOOL Ret = FALSE; - + if(!lpFileName || !lpExistingFileName) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + lpSecurityDescriptor = (lpSecurityAttributes ? lpSecurityAttributes->lpSecurityDescriptor : NULL); - + if(RtlDetermineDosPathNameType_U((LPWSTR)lpFileName) == 1 || RtlDetermineDosPathNameType_U((LPWSTR)lpExistingFileName) == 1) { @@ -50,7 +50,7 @@ CreateHardLinkW(LPCWSTR lpFileName, SetLastError(ERROR_INVALID_NAME); return FALSE; } - + if(RtlDosPathNameToNtPathName_U((LPWSTR)lpExistingFileName, &LinkTarget, NULL, NULL)) { ULONG NeededSize = RtlGetFullPathName_U((LPWSTR)lpExistingFileName, 0, NULL, NULL); @@ -60,24 +60,24 @@ CreateHardLinkW(LPCWSTR lpFileName, if(lpNtLinkTarget != NULL) { LPWSTR lpFilePart; - + if(RtlGetFullPathName_U((LPWSTR)lpExistingFileName, NeededSize, lpNtLinkTarget, &lpFilePart) && (*lpNtLinkTarget) != L'\0') { UNICODE_STRING CheckDrive, LinkDrive; WCHAR wCheckDrive[10]; - + swprintf(wCheckDrive, L"\\??\\%c:", (WCHAR)(*lpNtLinkTarget)); RtlInitUnicodeString(&CheckDrive, wCheckDrive); - + RtlZeroMemory(&LinkDrive, sizeof(UNICODE_STRING)); - + LinkDrive.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, (MAX_PATH + 1) * sizeof(WCHAR)); if(LinkDrive.Buffer != NULL) { HANDLE hFile, hTarget; OBJECT_ATTRIBUTES ObjectAttributes; - + InitializeObjectAttributes(&ObjectAttributes, &CheckDrive, OBJ_CASE_INSENSITIVE, @@ -88,11 +88,11 @@ CreateHardLinkW(LPCWSTR lpFileName, if(NT_SUCCESS(Status)) { UNICODE_STRING LanManager; - + RtlInitUnicodeString(&LanManager, L"\\Device\\LanmanRedirector\\"); - + NtQuerySymbolicLinkObject(hFile, &LinkDrive, NULL); - + if(!RtlPrefixUnicodeString(&LanManager, &LinkDrive, TRUE)) { InitializeObjectAttributes(&ObjectAttributes, @@ -118,7 +118,7 @@ CreateHardLinkW(LPCWSTR lpFileName, LinkInformation->RootDirectory = 0; LinkInformation->FileNameLength = LinkName.Length; RtlCopyMemory(LinkInformation->FileName, LinkName.Buffer, LinkName.Length); - + Status = NtSetInformationFile(hTarget, &IoStatus, LinkInformation, NeededSize, FileLinkInformation); if(NT_SUCCESS(Status)) { @@ -153,7 +153,7 @@ CreateHardLinkW(LPCWSTR lpFileName, DPRINT1("Path \"%wZ\" must not be a mapped drive!\n", &LinkDrive); SetLastError(ERROR_INVALID_NAME); } - + NtClose(hFile); } else @@ -202,23 +202,23 @@ CreateHardLinkA(LPCSTR lpFileName, { PWCHAR FileNameW, ExistingFileNameW; BOOL Ret; - + if(!lpFileName || !lpExistingFileName) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + if (!(FileNameW = FilenameA2W(lpFileName, FALSE))) return FALSE; if (!(ExistingFileNameW = FilenameA2W(lpExistingFileName, TRUE))) return FALSE; - + Ret = CreateHardLinkW(FileNameW , ExistingFileNameW , lpSecurityAttributes); - + RtlFreeHeap(RtlGetProcessHeap(), 0, ExistingFileNameW); - + return Ret; } diff --git a/reactos/lib/kernel32/file/iocompl.c b/reactos/lib/kernel32/file/iocompl.c index 948542e084a..6adf65c8320 100644 --- a/reactos/lib/kernel32/file/iocompl.c +++ b/reactos/lib/kernel32/file/iocompl.c @@ -32,17 +32,17 @@ CreateIoCompletionPort( FILE_COMPLETION_INFORMATION CompletionInformation; IO_STATUS_BLOCK IoStatusBlock; - if ( ExistingCompletionPort == NULL && FileHandle == INVALID_HANDLE_VALUE ) + if ( ExistingCompletionPort == NULL && FileHandle == INVALID_HANDLE_VALUE ) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - if ( ExistingCompletionPort != NULL ) + if ( ExistingCompletionPort != NULL ) { CompletionPort = ExistingCompletionPort; } - else + else { errCode = NtCreateIoCompletion(&CompletionPort, @@ -50,15 +50,15 @@ CreateIoCompletionPort( NULL,//ObjectAttributes NumberOfConcurrentThreads); - if (!NT_SUCCESS(errCode) ) + if (!NT_SUCCESS(errCode) ) { SetLastErrorByStatus (errCode); return FALSE; } } - - if ( FileHandle != INVALID_HANDLE_VALUE ) + + if ( FileHandle != INVALID_HANDLE_VALUE ) { #ifdef __USE_W32API CompletionInformation.Port = CompletionPort; @@ -68,19 +68,19 @@ CreateIoCompletionPort( CompletionInformation.CompletionKey = CompletionKey; #endif - errCode = NtSetInformationFile(FileHandle, + errCode = NtSetInformationFile(FileHandle, &IoStatusBlock, &CompletionInformation, sizeof(FILE_COMPLETION_INFORMATION), FileCompletionInformation); - if ( !NT_SUCCESS(errCode) ) + if ( !NT_SUCCESS(errCode) ) { if ( ExistingCompletionPort == NULL ) { NtClose(CompletionPort); } - + SetLastErrorByStatus (errCode); return FALSE; } @@ -116,7 +116,7 @@ GetQueuedCompletionStatus( if (dwMilliseconds != INFINITE) { Interval.QuadPart = RELATIVE_TIME(MILLIS_TO_100NS(dwMilliseconds)); - } + } errCode = NtRemoveIoCompletion(CompletionHandle, (PVOID*)lpCompletionKey, @@ -157,13 +157,13 @@ PostQueuedCompletionStatus( { NTSTATUS errCode; - errCode = NtSetIoCompletion(CompletionHandle, - (PVOID)dwCompletionKey, - (PVOID)lpOverlapped,//CompletionValue + errCode = NtSetIoCompletion(CompletionHandle, + (PVOID)dwCompletionKey, + (PVOID)lpOverlapped,//CompletionValue STATUS_SUCCESS, //IoStatusBlock->Status dwNumberOfBytesTransferred); //IoStatusBlock->Information - if ( !NT_SUCCESS(errCode) ) + if ( !NT_SUCCESS(errCode) ) { SetLastErrorByStatus (errCode); return FALSE; diff --git a/reactos/lib/kernel32/file/lfile.c b/reactos/lib/kernel32/file/lfile.c index 2335ac6399a..e973d513d09 100644 --- a/reactos/lib/kernel32/file/lfile.c +++ b/reactos/lib/kernel32/file/lfile.c @@ -27,7 +27,7 @@ _hread( ) { DWORD NumberOfBytesRead; - + if ( !ReadFile( (HANDLE) hFile, (LPVOID) lpBuffer, @@ -53,7 +53,7 @@ _hwrite ( ) { DWORD NumberOfBytesWritten; - + if (lBytes == 0) { if ( !SetEndOfFile((HANDLE) hFile ) ) @@ -87,7 +87,7 @@ _lopen ( { DWORD dwAccessMask = 0; DWORD dwShareMode = 0; - + if ( (iReadWrite & OF_READWRITE ) == OF_READWRITE ) dwAccessMask = GENERIC_READ | GENERIC_WRITE; else if ( (iReadWrite & OF_READ ) == OF_READ ) diff --git a/reactos/lib/kernel32/file/lock.c b/reactos/lib/kernel32/file/lock.c index 797f51498ee..f5ca59da2cc 100644 --- a/reactos/lib/kernel32/file/lock.c +++ b/reactos/lib/kernel32/file/lock.c @@ -33,17 +33,17 @@ LockFile( DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh ) -{ +{ DWORD dwReserved; OVERLAPPED Overlapped; - + Overlapped.Offset = dwFileOffsetLow; Overlapped.OffsetHigh = dwFileOffsetHigh; Overlapped.hEvent = NULL; dwReserved = 0; return LockFileEx(hFile, LOCKFILE_FAIL_IMMEDIATELY|LOCKFILE_EXCLUSIVE_LOCK,dwReserved,nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, &Overlapped ) ; - + } @@ -61,36 +61,36 @@ LockFileEx( LPOVERLAPPED lpOverlapped /* required! */ ) { - LARGE_INTEGER BytesToLock; + LARGE_INTEGER BytesToLock; BOOL LockImmediate; BOOL LockExclusive; NTSTATUS errCode; LARGE_INTEGER Offset; - - if(dwReserved != 0 || lpOverlapped==NULL) - { + + if(dwReserved != 0 || lpOverlapped==NULL) + { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - - lpOverlapped->Internal = STATUS_PENDING; - + + lpOverlapped->Internal = STATUS_PENDING; + Offset.u.LowPart = lpOverlapped->Offset; Offset.u.HighPart = lpOverlapped->OffsetHigh; - + if ( (dwFlags & LOCKFILE_FAIL_IMMEDIATELY) == LOCKFILE_FAIL_IMMEDIATELY ) LockImmediate = TRUE; else LockImmediate = FALSE; - + if ( (dwFlags & LOCKFILE_EXCLUSIVE_LOCK) == LOCKFILE_EXCLUSIVE_LOCK ) LockExclusive = TRUE; else LockExclusive = FALSE; - + BytesToLock.u.LowPart = nNumberOfBytesToLockLow; BytesToLock.u.HighPart = nNumberOfBytesToLockHigh; - + errCode = NtLockFile(hFile, lpOverlapped->hEvent, NULL, @@ -101,14 +101,14 @@ LockFileEx( NULL, LockImmediate, LockExclusive); - if ( !NT_SUCCESS(errCode) ) + if ( !NT_SUCCESS(errCode) ) { SetLastErrorByStatus (errCode); return FALSE; } - + return TRUE; - + } @@ -130,7 +130,7 @@ UnlockFile( Overlapped.Offset = dwFileOffsetLow; Overlapped.OffsetHigh = dwFileOffsetHigh; dwReserved = 0; - + return UnlockFileEx(hFile, dwReserved, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh, &Overlapped); } @@ -138,8 +138,8 @@ UnlockFile( /* * @implemented */ -BOOL -STDCALL +BOOL +STDCALL UnlockFileEx( HANDLE hFile, DWORD dwReserved, @@ -151,19 +151,19 @@ UnlockFileEx( LARGE_INTEGER BytesToUnLock; LARGE_INTEGER StartAddress; NTSTATUS errCode; - - if(dwReserved != 0 || lpOverlapped == NULL) + + if(dwReserved != 0 || lpOverlapped == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + BytesToUnLock.u.LowPart = nNumberOfBytesToUnLockLow; BytesToUnLock.u.HighPart = nNumberOfBytesToUnLockHigh; - + StartAddress.u.LowPart = lpOverlapped->Offset; StartAddress.u.HighPart = lpOverlapped->OffsetHigh; - + errCode = NtUnlockFile(hFile, (PIO_STATUS_BLOCK)lpOverlapped, &StartAddress, @@ -173,7 +173,7 @@ UnlockFileEx( SetLastErrorByStatus (errCode); return FALSE; } - + return TRUE; } diff --git a/reactos/lib/kernel32/file/mailslot.c b/reactos/lib/kernel32/file/mailslot.c index 3886ca813b4..77338a6a7b6 100644 --- a/reactos/lib/kernel32/file/mailslot.c +++ b/reactos/lib/kernel32/file/mailslot.c @@ -29,17 +29,17 @@ CreateMailslotA(LPCSTR lpName, HANDLE MailslotHandle; UNICODE_STRING NameU; ANSI_STRING NameA; - + RtlInitAnsiString(&NameA, (LPSTR)lpName); RtlAnsiStringToUnicodeString(&NameU, &NameA, TRUE); - + MailslotHandle = CreateMailslotW(NameU.Buffer, nMaxMessageSize, lReadTimeout, lpSecurityAttributes); - + RtlFreeUnicodeString(&NameU); - + return(MailslotHandle); } @@ -62,7 +62,7 @@ CreateMailslotW(LPCWSTR lpName, IO_STATUS_BLOCK Iosb; ULONG Attributes = OBJ_CASE_INSENSITIVE; PSECURITY_DESCRIPTOR SecurityDescriptor = NULL; - + Result = RtlDosPathNameToNtPathName_U((LPWSTR)lpName, &MailslotName, NULL, @@ -72,24 +72,24 @@ CreateMailslotW(LPCWSTR lpName, SetLastError(ERROR_PATH_NOT_FOUND); return(INVALID_HANDLE_VALUE); } - + DPRINT("Mailslot name: %wZ\n", &MailslotName); - + if(lpSecurityAttributes) { SecurityDescriptor = lpSecurityAttributes->lpSecurityDescriptor; if(lpSecurityAttributes->bInheritHandle) Attributes |= OBJ_INHERIT; } - + InitializeObjectAttributes(&ObjectAttributes, &MailslotName, Attributes, NULL, SecurityDescriptor); - + DefaultTimeOut.QuadPart = lReadTimeout * 10000; - + Status = NtCreateMailslotFile(&MailslotHandle, GENERIC_READ | SYNCHRONIZE | WRITE_DAC, &ObjectAttributes, @@ -98,16 +98,16 @@ CreateMailslotW(LPCWSTR lpName, 0, nMaxMessageSize, &DefaultTimeOut); - + RtlFreeUnicodeString(&MailslotName); - + if (!NT_SUCCESS(Status)) { DPRINT("NtCreateMailslot failed (Status %x)!\n", Status); SetLastErrorByStatus (Status); return(INVALID_HANDLE_VALUE); } - + return(MailslotHandle); } @@ -125,7 +125,7 @@ GetMailslotInfo(HANDLE hMailslot, FILE_MAILSLOT_QUERY_INFORMATION Buffer; IO_STATUS_BLOCK Iosb; NTSTATUS Status; - + Status = NtQueryInformationFile(hMailslot, &Iosb, &Buffer, @@ -137,7 +137,7 @@ GetMailslotInfo(HANDLE hMailslot, SetLastErrorByStatus (Status); return(FALSE); } - + if (lpMaxMessageSize != NULL) { *lpMaxMessageSize = Buffer.MaximumMessageSize; @@ -154,7 +154,7 @@ GetMailslotInfo(HANDLE hMailslot, { *lpReadTimeout = (DWORD)(Buffer.ReadTimeout.QuadPart / -10000); } - + return(TRUE); } @@ -169,9 +169,9 @@ SetMailslotInfo(HANDLE hMailslot, FILE_MAILSLOT_SET_INFORMATION Buffer; IO_STATUS_BLOCK Iosb; NTSTATUS Status; - + Buffer.ReadTimeout.QuadPart = lReadTimeout * -10000; - + Status = NtSetInformationFile(hMailslot, &Iosb, &Buffer, @@ -183,7 +183,7 @@ SetMailslotInfo(HANDLE hMailslot, SetLastErrorByStatus (Status); return(FALSE); } - + return(TRUE); } diff --git a/reactos/lib/kernel32/file/move.c b/reactos/lib/kernel32/file/move.c index a7ae400eda4..24f8c4bd5d0 100644 --- a/reactos/lib/kernel32/file/move.c +++ b/reactos/lib/kernel32/file/move.c @@ -204,7 +204,7 @@ MoveFileWithProgressW ( RtlFreeHeap (RtlGetProcessHeap (), 0, DstPathU.Buffer); - /* + /* * FIXME: * Is the length the count of characters or the length of the buffer? */ @@ -279,7 +279,7 @@ MoveFileWithProgressW ( if (Result) { /* Cleanup the source file */ - AdjustFileAttributes(lpExistingFileName, lpNewFileName); + AdjustFileAttributes(lpExistingFileName, lpNewFileName); Result = DeleteFileW (lpExistingFileName); } } @@ -309,7 +309,7 @@ MoveFileWithProgressA ( PWCHAR ExistingFileNameW; PWCHAR NewFileNameW; BOOL ret; - + if (!(ExistingFileNameW = FilenameA2W(lpExistingFileName, FALSE))) return FALSE; diff --git a/reactos/lib/kernel32/file/npipe.c b/reactos/lib/kernel32/file/npipe.c index 7e4d2f00e9b..daba363ba55 100644 --- a/reactos/lib/kernel32/file/npipe.c +++ b/reactos/lib/kernel32/file/npipe.c @@ -33,10 +33,10 @@ CreateNamedPipeA(LPCSTR lpName, HANDLE NamedPipeHandle; UNICODE_STRING NameU; ANSI_STRING NameA; - + RtlInitAnsiString(&NameA, (LPSTR)lpName); RtlAnsiStringToUnicodeString(&NameU, &NameA, TRUE); - + NamedPipeHandle = CreateNamedPipeW(NameU.Buffer, dwOpenMode, dwPipeMode, @@ -45,9 +45,9 @@ CreateNamedPipeA(LPCSTR lpName, nInBufferSize, nDefaultTimeOut, lpSecurityAttributes); - + RtlFreeUnicodeString(&NameU); - + return(NamedPipeHandle); } @@ -220,14 +220,14 @@ WaitNamedPipeA(LPCSTR lpNamedPipeName, BOOL r; UNICODE_STRING NameU; ANSI_STRING NameA; - + RtlInitAnsiString(&NameA, (LPSTR)lpNamedPipeName); RtlAnsiStringToUnicodeString(&NameU, &NameA, TRUE); - + r = WaitNamedPipeW(NameU.Buffer, nTimeOut); - + RtlFreeUnicodeString(&NameU); - + return(r); } @@ -246,7 +246,7 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, NPFS_WAIT_PIPE WaitPipe; HANDLE FileHandle; IO_STATUS_BLOCK Iosb; - + r = RtlDosPathNameToNtPathName_U((LPWSTR)lpNamedPipeName, &NamedPipeName, NULL, @@ -255,7 +255,7 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, { return(FALSE); } - + InitializeObjectAttributes(&ObjectAttributes, &NamedPipeName, OBJ_CASE_INSENSITIVE, @@ -272,9 +272,9 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, SetLastErrorByStatus (Status); return(FALSE); } - + WaitPipe.Timeout.QuadPart = nTimeOut * -10000LL; - + Status = NtFsControlFile(FileHandle, NULL, NULL, @@ -291,7 +291,7 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, SetLastErrorByStatus (Status); return(FALSE); } - + return(TRUE); } @@ -304,14 +304,14 @@ ConnectNamedPipe(IN HANDLE hNamedPipe, IN LPOVERLAPPED lpOverlapped) { NTSTATUS Status; - + if (lpOverlapped != NULL) { PVOID ApcContext; - + lpOverlapped->Internal = STATUS_PENDING; ApcContext = (((ULONG_PTR)lpOverlapped->hEvent & 0x1) ? NULL : lpOverlapped); - + Status = NtFsControlFile(hNamedPipe, lpOverlapped->hEvent, NULL, @@ -333,7 +333,7 @@ ConnectNamedPipe(IN HANDLE hNamedPipe, else { IO_STATUS_BLOCK Iosb; - + Status = NtFsControlFile(hNamedPipe, NULL, NULL, @@ -430,7 +430,7 @@ SetNamedPipeHandleState(HANDLE hNamedPipe, SetState.WriteModeMessage = GetState.WriteModeMessage; SetState.NonBlocking = SetState.NonBlocking; } - + if (lpMaxCollectionCount != NULL) { SetState.InBufferSize = *lpMaxCollectionCount; @@ -439,9 +439,9 @@ SetNamedPipeHandleState(HANDLE hNamedPipe, { SetState.InBufferSize = GetState.InBufferSize; } - + SetState.OutBufferSize = GetState.OutBufferSize; - + if (lpCollectDataTimeout != NULL) { SetState.Timeout.QuadPart = (*lpCollectDataTimeout) * -10000LL; @@ -491,10 +491,10 @@ CallNamedPipeA(LPCSTR lpNamedPipeName, { UNICODE_STRING PipeName; BOOL Result; - + RtlCreateUnicodeStringFromAsciiz(&PipeName, (LPSTR)lpNamedPipeName); - + Result = CallNamedPipeW(PipeName.Buffer, lpInBuffer, nInBufferSize, @@ -502,9 +502,9 @@ CallNamedPipeA(LPCSTR lpNamedPipeName, nOutBufferSize, lpBytesRead, nTimeOut); - + RtlFreeUnicodeString(&PipeName); - + return(Result); } @@ -629,7 +629,7 @@ GetNamedPipeHandleStateW(HANDLE hNamedPipe, if (lpState != NULL) { FILE_PIPE_INFORMATION PipeInfo; - + Status = NtQueryInformationFile(hNamedPipe, &StatusBlock, &PipeInfo, @@ -648,7 +648,7 @@ GetNamedPipeHandleStateW(HANDLE hNamedPipe, if(lpCurInstances != NULL) { FILE_PIPE_LOCAL_INFORMATION LocalInfo; - + Status = NtQueryInformationFile(hNamedPipe, &StatusBlock, &LocalInfo, @@ -666,7 +666,7 @@ GetNamedPipeHandleStateW(HANDLE hNamedPipe, if(lpMaxCollectionCount != NULL || lpCollectDataTimeout != NULL) { FILE_PIPE_REMOTE_INFORMATION RemoteInfo; - + Status = NtQueryInformationFile(hNamedPipe, &StatusBlock, &RemoteInfo, @@ -682,14 +682,14 @@ GetNamedPipeHandleStateW(HANDLE hNamedPipe, { *lpMaxCollectionCount = RemoteInfo.MaximumCollectionCount; } - + if(lpCollectDataTimeout != NULL) { /* FIXME */ *lpCollectDataTimeout = 0; } } - + if(lpUserName != NULL) { /* FIXME - open the thread token, call ImpersonateNamedPipeClient() and @@ -716,18 +716,18 @@ GetNamedPipeHandleStateA(HANDLE hNamedPipe, UNICODE_STRING UserNameW; ANSI_STRING UserNameA; BOOL Ret; - + if(lpUserName != NULL) { UserNameW.Length = 0; UserNameW.MaximumLength = nMaxUserNameSize * sizeof(WCHAR); UserNameW.Buffer = HeapAlloc(GetCurrentProcess(), 0, UserNameW.MaximumLength); - + UserNameA.Buffer = lpUserName; UserNameA.Length = 0; UserNameA.MaximumLength = nMaxUserNameSize; } - + Ret = GetNamedPipeHandleStateW(hNamedPipe, lpState, lpCurInstances, @@ -745,12 +745,12 @@ GetNamedPipeHandleStateA(HANDLE hNamedPipe, Ret = FALSE; } } - + if(UserNameW.Buffer != NULL) { HeapFree(GetCurrentProcess(), 0, UserNameW.Buffer); } - + return Ret; } @@ -768,7 +768,7 @@ GetNamedPipeInfo(HANDLE hNamedPipe, FILE_PIPE_LOCAL_INFORMATION PipeLocalInformation; IO_STATUS_BLOCK StatusBlock; NTSTATUS Status; - + Status = NtQueryInformationFile(hNamedPipe, &StatusBlock, &PipeLocalInformation, @@ -779,19 +779,19 @@ GetNamedPipeInfo(HANDLE hNamedPipe, SetLastErrorByStatus(Status); return(FALSE); } - + if (lpFlags != NULL) { *lpFlags = (PipeLocalInformation.NamedPipeEnd == FILE_PIPE_SERVER_END) ? PIPE_SERVER_END : PIPE_CLIENT_END; *lpFlags |= (PipeLocalInformation.NamedPipeType == 1) ? PIPE_TYPE_MESSAGE : PIPE_TYPE_BYTE; } - + if (lpOutBufferSize != NULL) *lpOutBufferSize = PipeLocalInformation.OutboundQuota; - + if (lpInBufferSize != NULL) *lpInBufferSize = PipeLocalInformation.InboundQuota; - + if (lpMaxInstances != NULL) { if (PipeLocalInformation.MaximumInstances >= 255) @@ -799,7 +799,7 @@ GetNamedPipeInfo(HANDLE hNamedPipe, else *lpMaxInstances = PipeLocalInformation.MaximumInstances; } - + return(TRUE); } @@ -901,7 +901,7 @@ TransactNamedPipe(IN HANDLE hNamedPipe, IN LPOVERLAPPED lpOverlapped OPTIONAL) { NTSTATUS Status; - + if (lpBytesRead != NULL) { *lpBytesRead = 0; @@ -940,7 +940,7 @@ TransactNamedPipe(IN HANDLE hNamedPipe, else { IO_STATUS_BLOCK Iosb; - + Status = NtFsControlFile(hNamedPipe, NULL, NULL, diff --git a/reactos/lib/kernel32/file/rw.c b/reactos/lib/kernel32/file/rw.c index 6b0d9e4cd99..a01b25db304 100644 --- a/reactos/lib/kernel32/file/rw.c +++ b/reactos/lib/kernel32/file/rw.c @@ -32,12 +32,12 @@ WriteFile(IN HANDLE hFile, NTSTATUS Status; DPRINT("WriteFile(hFile %x)\n", hFile); - + if (lpNumberOfBytesWritten != NULL) { *lpNumberOfBytesWritten = 0; } - + if (IsConsoleHandle(hFile)) { return WriteConsoleA(hFile, @@ -46,17 +46,17 @@ WriteFile(IN HANDLE hFile, lpNumberOfBytesWritten, lpOverlapped); } - + if (lpOverlapped != NULL) { LARGE_INTEGER Offset; PVOID ApcContext; - + Offset.u.LowPart = lpOverlapped->Offset; Offset.u.HighPart = lpOverlapped->OffsetHigh; lpOverlapped->Internal = STATUS_PENDING; ApcContext = (((ULONG_PTR)lpOverlapped->hEvent & 0x1) ? NULL : lpOverlapped); - + Status = NtWriteFile(hFile, lpOverlapped->hEvent, NULL, @@ -79,10 +79,10 @@ WriteFile(IN HANDLE hFile, *lpNumberOfBytesWritten = lpOverlapped->InternalHigh; } } - else + else { IO_STATUS_BLOCK Iosb; - + Status = NtWriteFile(hFile, NULL, NULL, @@ -118,7 +118,7 @@ WriteFile(IN HANDLE hFile, return FALSE; } } - + DPRINT("WriteFile() succeeded\n"); return TRUE; } @@ -244,14 +244,14 @@ ReadFile(IN HANDLE hFile, } VOID STDCALL -ApcRoutine(PVOID ApcContext, - struct _IO_STATUS_BLOCK* IoStatusBlock, +ApcRoutine(PVOID ApcContext, + struct _IO_STATUS_BLOCK* IoStatusBlock, ULONG Reserved) { DWORD dwErrorCode; LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine = (LPOVERLAPPED_COMPLETION_ROUTINE)ApcContext; - + dwErrorCode = RtlNtStatusToDosError(IoStatusBlock->Status); lpCompletionRoutine(dwErrorCode, IoStatusBlock->Information, @@ -262,7 +262,7 @@ ApcRoutine(PVOID ApcContext, /* * @implemented */ -BOOL STDCALL +BOOL STDCALL WriteFileEx(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, @@ -308,7 +308,7 @@ ReadFileEx(IN HANDLE hFile, { LARGE_INTEGER Offset; NTSTATUS Status; - + Offset.u.LowPart = lpOverlapped->Offset; Offset.u.HighPart = lpOverlapped->OffsetHigh; lpOverlapped->Internal = STATUS_PENDING; @@ -328,7 +328,7 @@ ReadFileEx(IN HANDLE hFile, SetLastErrorByStatus(Status); return FALSE; } - + return TRUE; } diff --git a/reactos/lib/kernel32/file/volume.c b/reactos/lib/kernel32/file/volume.c index 27a8ea35ce4..2d08172e244 100644 --- a/reactos/lib/kernel32/file/volume.c +++ b/reactos/lib/kernel32/file/volume.c @@ -13,7 +13,7 @@ */ //WINE copyright notice: /* - * DOS drives handling functions + * DOS drives handling functions * * Copyright 1993 Erik Bos * Copyright 1996 Alexandre Julliard @@ -195,7 +195,7 @@ GetDiskFreeSpaceA ( if (!(RootPathNameW = FilenameA2W(lpRootPathName, FALSE))) return FALSE; } - + return GetDiskFreeSpaceW (RootPathNameW, lpSectorsPerCluster, lpBytesPerSector, @@ -324,7 +324,7 @@ GetDiskFreeSpaceExW( { return FALSE; } - + errCode = NtQueryVolumeInformationFile(hFile, &IoStatusBlock, &FileFsSize, @@ -344,7 +344,7 @@ GetDiskFreeSpaceExW( if (lpFreeBytesAvailableToCaller) lpFreeBytesAvailableToCaller->QuadPart = BytesPerCluster.QuadPart * FileFsSize.AvailableAllocationUnits.QuadPart; - + if (lpTotalNumberOfBytes) lpTotalNumberOfBytes->QuadPart = BytesPerCluster.QuadPart * FileFsSize.TotalAllocationUnits.QuadPart; @@ -365,7 +365,7 @@ UINT STDCALL GetDriveTypeA(LPCSTR lpRootPathName) { PWCHAR RootPathNameW; - + if (!(RootPathNameW = FilenameA2W(lpRootPathName, FALSE))) return DRIVE_UNKNOWN; @@ -400,7 +400,7 @@ GetDriveTypeW(LPCWSTR lpRootPathName) { CloseHandle(hFile); SetLastErrorByStatus (errCode); - return 0; + return 0; } CloseHandle(hFile); @@ -452,7 +452,7 @@ GetVolumeInformationA( if (!(RootPathNameW = FilenameA2W(lpRootPathName, FALSE))) return FALSE; - + if (lpVolumeNameBuffer) { VolumeNameU.Length = 0; @@ -603,7 +603,7 @@ GetVolumeInformationW( FileFsVolume, FS_VOLUME_BUFFER_SIZE, FileFsVolumeInformation); - if ( !NT_SUCCESS(errCode) ) + if ( !NT_SUCCESS(errCode) ) { DPRINT("Status: %x\n", errCode); CloseHandle(hFile); @@ -618,8 +618,8 @@ GetVolumeInformationW( { if (nVolumeNameSize * sizeof(WCHAR) >= FileFsVolume->VolumeLabelLength + sizeof(WCHAR)) { - memcpy(lpVolumeNameBuffer, - FileFsVolume->VolumeLabel, + memcpy(lpVolumeNameBuffer, + FileFsVolume->VolumeLabel, FileFsVolume->VolumeLabelLength); lpVolumeNameBuffer[FileFsVolume->VolumeLabelLength / sizeof(WCHAR)] = 0; } @@ -652,8 +652,8 @@ GetVolumeInformationW( { if (nFileSystemNameSize * sizeof(WCHAR) >= FileFsAttribute->FileSystemNameLength + sizeof(WCHAR)) { - memcpy(lpFileSystemNameBuffer, - FileFsAttribute->FileSystemName, + memcpy(lpFileSystemNameBuffer, + FileFsAttribute->FileSystemName, FileFsAttribute->FileSystemNameLength); lpFileSystemNameBuffer[FileFsAttribute->FileSystemNameLength / sizeof(WCHAR)] = 0; } @@ -689,7 +689,7 @@ SetVolumeLabelA ( if (!(VolumeNameW = FilenameA2W(lpVolumeName, TRUE))) return FALSE; } - + Result = SetVolumeLabelW (RootPathNameW, VolumeNameW); @@ -718,7 +718,7 @@ SetVolumeLabelW( ULONG LabelLength; HANDLE hFile; NTSTATUS Status; - + LabelLength = wcslen(lpVolumeName) * sizeof(WCHAR); LabelInfo = RtlAllocateHeap(RtlGetProcessHeap(), 0, @@ -737,7 +737,7 @@ SetVolumeLabelW( LabelInfo); return FALSE; } - + Status = NtSetVolumeInformationFile(hFile, &IoStatusBlock, LabelInfo, diff --git a/reactos/lib/kernel32/include/kernel32.h b/reactos/lib/kernel32/include/kernel32.h index c659c873e04..d52b3498c0c 100755 --- a/reactos/lib/kernel32/include/kernel32.h +++ b/reactos/lib/kernel32/include/kernel32.h @@ -26,7 +26,7 @@ #define SetLastErrorByStatus(__S__) \ ((void)SetLastError(RtlNtStatusToDosError(__S__))) -typedef +typedef DWORD (*WaitForInputIdleType)( HANDLE hProcess, @@ -62,7 +62,7 @@ PTEB GetTeb(VOID); PWCHAR FilenameA2W(LPCSTR NameA, BOOL alloc); - + DWORD FilenameW2A_FitOrFail(LPSTR DestA, INT destLen, LPCWSTR SourceW, INT sourceLen); DWORD FilenameU2A_FitOrFail(LPSTR DestA, INT destLen, PUNICODE_STRING SourceU); diff --git a/reactos/lib/kernel32/mem/global.c b/reactos/lib/kernel32/mem/global.c index aad8748ee61..2829b77c873 100644 --- a/reactos/lib/kernel32/mem/global.c +++ b/reactos/lib/kernel32/mem/global.c @@ -2,7 +2,7 @@ * * Win32 Global/Local heap functions (GlobalXXX, LocalXXX). * These functions included in Win32 for compatibility with 16 bit Windows - * Especially the moveable blocks and handles are oldish. + * Especially the moveable blocks and handles are oldish. * But the ability to directly allocate memory with GPTR and LPTR is widely * used. * @@ -74,7 +74,7 @@ GlobalAlloc(UINT uFlags, } DPRINT("GlobalAlloc( 0x%X, 0x%lX )\n", uFlags, dwBytes); - + //Changed hProcessHeap to GetProcessHeap() if ((uFlags & GMEM_MOVEABLE)==0) /* POINTER */ { @@ -132,7 +132,7 @@ GlobalAlloc(UINT uFlags, RtlFreeHeap(GetProcessHeap(), 0, phandle); return NULL; } - return INTERN_TO_HANDLE(phandle); + return INTERN_TO_HANDLE(phandle); } else return (HGLOBAL)0; @@ -179,7 +179,7 @@ GlobalFlags(HGLOBAL hMem) else { HeapLock(GetProcessHeap()); - + phandle = HANDLE_TO_INTERN(hMem); /*DbgPrintStruct(phandle);*/ @@ -213,7 +213,7 @@ HGLOBAL STDCALL GlobalFree(HGLOBAL hMem) { PGLOBAL_HANDLE phandle; - + DPRINT("GlobalFree( 0x%lX )\n", (ULONG)hMem); if (ISPOINTER(hMem)) /* POINTER */ @@ -224,7 +224,7 @@ GlobalFree(HGLOBAL hMem) else /* HANDLE */ { HeapLock(GetProcessHeap()); - + phandle = HANDLE_TO_INTERN(hMem); if(MAGIC_GLOBAL_USED == phandle->Magic) @@ -235,14 +235,14 @@ GlobalFree(HGLOBAL hMem) DPRINT1("Warning! GlobalFree(0x%X) Freeing a handle to a locked object.\n", hMem); SetLastError(ERROR_INVALID_HANDLE); } - + if(phandle->Pointer) RtlFreeHeap(GetProcessHeap(), 0, phandle->Pointer - HANDLE_SIZE); - + RtlFreeHeap(GetProcessHeap(), 0, phandle); } HeapUnlock(GetProcessHeap()); - + hMem = 0; } return hMem; @@ -266,7 +266,7 @@ GlobalHandle(LPCVOID pMem) DPRINT1("Error: 0 handle.\n"); return 0; } - + HeapLock(GetProcessHeap()); /* Now test to see if this pointer is associated with a handle. * This is done by calling RtlValidateHeap() and seeing if it fails. @@ -278,10 +278,10 @@ GlobalHandle(LPCVOID pMem) } else /*MOVABLE*/ { - handle = POINTER_TO_HANDLE(pMem); + handle = POINTER_TO_HANDLE(pMem); } - - + + /* Test to see if this memory is valid*/ test = HANDLE_TO_INTERN(handle); if (!IsBadReadPtr(test, sizeof(GLOBAL_HANDLE))) @@ -318,7 +318,7 @@ GlobalLock(HGLOBAL hMem) { PGLOBAL_HANDLE phandle; LPVOID palloc; - + DPRINT("GlobalLock( 0x%lX )\n", (ULONG)hMem); if (ISPOINTER(hMem)) @@ -327,7 +327,7 @@ GlobalLock(HGLOBAL hMem) HeapLock(GetProcessHeap()); phandle = HANDLE_TO_INTERN(hMem); - + if(MAGIC_GLOBAL_USED == phandle->Magic) { if(GLOBAL_LOCK_MAX > phandle->LockCount) @@ -343,7 +343,7 @@ GlobalLock(HGLOBAL hMem) } HeapUnlock(GetProcessHeap()); - + return palloc; } @@ -385,7 +385,7 @@ GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer) { SetLastErrorByStatus(Status); return FALSE; - } + } Status = ZwQuerySystemInformation(SystemFullMemoryInformation, &UserMemory, @@ -395,7 +395,7 @@ GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer) { SetLastErrorByStatus(Status); return FALSE; - } + } /* * Load percentage 0 thru 100. 0 is good and 100 is bad. @@ -410,7 +410,7 @@ GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer) SysBasicInfo.NumberOfPhysicalPages; DPRINT1("Memory Load: %d\n",lpBuffer->dwMemoryLoad ); - + lpBuffer->ullTotalPhys = SysBasicInfo.NumberOfPhysicalPages * SysBasicInfo.PhysicalPageSize; lpBuffer->ullAvailPhys = SysPerfInfo.AvailablePages * @@ -429,7 +429,7 @@ GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer) SysBasicInfo.PhysicalPageSize); /* VM available to the calling processes, User Mem? */ - lpBuffer->ullTotalVirtual = SysBasicInfo.HighestUserAddress - + lpBuffer->ullTotalVirtual = SysBasicInfo.HighestUserAddress - SysBasicInfo.LowestUserAddress; lpBuffer->ullAvailVirtual = (lpBuffer->ullTotalVirtual - @@ -452,11 +452,11 @@ VOID STDCALL GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) { MEMORYSTATUSEX lpBufferEx; -#if 0 +#if 0 if (lpBuffer->dwLength != sizeof(MEMORYSTATUS)) { SetLastError(ERROR_INVALID_PARAMETER); - return; + return; } #endif lpBufferEx.dwLength = sizeof(MEMORYSTATUSEX); @@ -496,7 +496,7 @@ GlobalReAlloc(HGLOBAL hMem, } HeapLock(GetProcessHeap()); - + if(uFlags & GMEM_MODIFY) /* modify flags */ { if( ISPOINTER(hMem) && (uFlags & GMEM_MOVEABLE)) @@ -586,7 +586,7 @@ GlobalReAlloc(HGLOBAL hMem, } } HeapUnlock(GetProcessHeap()); - + return hnew; } @@ -596,9 +596,9 @@ GlobalSize(HGLOBAL hMem) { SIZE_T retval = 0; PGLOBAL_HANDLE phandle = 0; - + DPRINT("GlobalSize( 0x%lX )\n", (ULONG)hMem); - + if(ISPOINTER(hMem)) /*FIXED*/ { retval = RtlSizeHeap(GetProcessHeap(), 0, hMem); @@ -606,15 +606,15 @@ GlobalSize(HGLOBAL hMem) else /*MOVEABLE*/ { HeapLock(GetProcessHeap()); - + phandle = HANDLE_TO_INTERN(hMem); - + if (MAGIC_GLOBAL_USED == phandle->Magic) { if (0 != phandle->Pointer)/*NOT DISCARDED*/ { retval = RtlSizeHeap(GetProcessHeap(), 0, phandle->Pointer - HANDLE_SIZE); - + if (retval == (SIZE_T)-1) /*RtlSizeHeap failed*/ { /* diff --git a/reactos/lib/kernel32/mem/isbad.c b/reactos/lib/kernel32/mem/isbad.c index 5200a9e3d53..d42d6253740 100644 --- a/reactos/lib/kernel32/mem/isbad.c +++ b/reactos/lib/kernel32/mem/isbad.c @@ -46,13 +46,13 @@ strnlen ( /* * @implemented */ -BOOL +BOOL STDCALL IsBadReadPtr ( CONST VOID * lp, UINT ucb ) -{ +{ MEMORY_BASIC_INFORMATION MemoryInformation; if ( ucb == 0 ) @@ -65,36 +65,36 @@ IsBadReadPtr ( & MemoryInformation, sizeof (MEMORY_BASIC_INFORMATION) ); - + if ( MemoryInformation.State != MEM_COMMIT ) { return TRUE; } - + if ( MemoryInformation.RegionSize < ucb ) { return TRUE; } - + if ( MemoryInformation.Protect == PAGE_EXECUTE ) { return TRUE; } - + if ( MemoryInformation.Protect == PAGE_NOACCESS ) { return TRUE; } - + return FALSE; - + } /* * @implemented */ -BOOL +BOOL STDCALL IsBadHugeReadPtr ( CONST VOID * lp, @@ -108,7 +108,7 @@ IsBadHugeReadPtr ( /* * @implemented */ -BOOL +BOOL STDCALL IsBadCodePtr ( FARPROC lpfn @@ -122,19 +122,19 @@ IsBadCodePtr ( & MemoryInformation, sizeof (MEMORY_BASIC_INFORMATION) ); - + if ( MemoryInformation.State != MEM_COMMIT ) { return TRUE; - } - + } + if ( (MemoryInformation.Protect == PAGE_EXECUTE) || (MemoryInformation.Protect == PAGE_EXECUTE_READ) ) { return FALSE; } - + return TRUE; } @@ -161,35 +161,35 @@ IsBadWritePtr ( & MemoryInformation, sizeof (MEMORY_BASIC_INFORMATION) ); - + if ( MemoryInformation.State != MEM_COMMIT ) { return TRUE; } - + if ( MemoryInformation.RegionSize < ucb ) { return TRUE; } - - + + if ( MemoryInformation.Protect == PAGE_READONLY) { return TRUE; } - + if ( (MemoryInformation.Protect == PAGE_EXECUTE) || (MemoryInformation.Protect == PAGE_EXECUTE_READ) ) { return TRUE; } - + if ( MemoryInformation.Protect == PAGE_NOACCESS ) { - return TRUE; + return TRUE; } - + return FALSE; } @@ -232,7 +232,7 @@ IsBadStringPtrW ( /* * @implemented */ -BOOL +BOOL STDCALL IsBadStringPtrA ( LPCSTR lpsz, diff --git a/reactos/lib/kernel32/mem/local.c b/reactos/lib/kernel32/mem/local.c index 77ae1006ae5..a2e28b135a7 100644 --- a/reactos/lib/kernel32/mem/local.c +++ b/reactos/lib/kernel32/mem/local.c @@ -13,7 +13,7 @@ /* NOTES - * + * * The local heap is the same as the global heap for win32 and both are only * required for legacy apps * diff --git a/reactos/lib/kernel32/mem/procmem.c b/reactos/lib/kernel32/mem/procmem.c index e9826c4e8db..925370c7555 100644 --- a/reactos/lib/kernel32/mem/procmem.c +++ b/reactos/lib/kernel32/mem/procmem.c @@ -3,7 +3,7 @@ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: lib/kernel32/mem/procmem.c - * PURPOSE: + * PURPOSE: * PROGRAMMER: Boudewijn Dekker */ diff --git a/reactos/lib/kernel32/mem/resnotify.c b/reactos/lib/kernel32/mem/resnotify.c index d4b6996609d..5e7786bc651 100644 --- a/reactos/lib/kernel32/mem/resnotify.c +++ b/reactos/lib/kernel32/mem/resnotify.c @@ -79,7 +79,7 @@ QueryMemoryResourceNotification( { EVENT_BASIC_INFORMATION ebi; NTSTATUS Status; - + if(ResourceState != NULL) { Status = NtQueryEvent(ResourceNotificationHandle, @@ -92,14 +92,14 @@ QueryMemoryResourceNotification( *ResourceState = ebi.EventState; return TRUE; } - + SetLastErrorByStatus(Status); } else /* ResourceState == NULL */ { SetLastError(ERROR_INVALID_PARAMETER); } - + return FALSE; } diff --git a/reactos/lib/kernel32/mem/section.c b/reactos/lib/kernel32/mem/section.c index 9211f8b3818..e2fc7376ceb 100644 --- a/reactos/lib/kernel32/mem/section.c +++ b/reactos/lib/kernel32/mem/section.c @@ -204,7 +204,7 @@ MapViewOfFileEx(HANDLE hFileMappingObject, Protect = PAGE_WRITECOPY; else Protect = PAGE_READWRITE; - + if (lpBaseAddress == NULL) { BaseAddress = NULL; @@ -286,7 +286,7 @@ OpenFileMappingA(DWORD dwDesiredAccess, OBJECT_ATTRIBUTES ObjectAttributes; ANSI_STRING AnsiName; UNICODE_STRING UnicodeName; - + if (lpName == NULL) { SetLastError(ERROR_INVALID_PARAMETER); diff --git a/reactos/lib/kernel32/misc/atom.c b/reactos/lib/kernel32/misc/atom.c index ed5300e3397..6643c9f8a30 100644 --- a/reactos/lib/kernel32/misc/atom.c +++ b/reactos/lib/kernel32/misc/atom.c @@ -47,8 +47,8 @@ GlobalAddAtomA(LPCSTR lpString) if (lstrlenA(lpString) > 255) { - /* This limit does not exist with NtAddAtom so the limit is probably - * added for compability. -Gunnar + /* This limit does not exist with NtAddAtom so the limit is probably + * added for compability. -Gunnar */ SetLastError(ERROR_INVALID_PARAMETER); return (ATOM)0; @@ -92,8 +92,8 @@ GlobalAddAtomW(LPCWSTR lpString) if (lstrlenW(lpString) > 255) { - /* This limit does not exist with NtAddAtom so the limit is probably - * added for compability. -Gunnar + /* This limit does not exist with NtAddAtom so the limit is probably + * added for compability. -Gunnar */ SetLastError(ERROR_INVALID_PARAMETER); return (ATOM)0; @@ -119,19 +119,19 @@ ATOM STDCALL GlobalDeleteAtom(ATOM nAtom) { NTSTATUS Status; - + if (nAtom < 0xC000) { return 0; } - + Status = NtDeleteAtom(nAtom); if (!NT_SUCCESS(Status)) { SetLastErrorByStatus(Status); return nAtom; } - + return 0; } @@ -158,8 +158,8 @@ GlobalFindAtomA(LPCSTR lpString) if (lstrlenA(lpString) > 255) { - /* This limit does not exist with NtAddAtom so the limit is probably - * added for compability. -Gunnar + /* This limit does not exist with NtAddAtom so the limit is probably + * added for compability. -Gunnar */ SetLastError(ERROR_INVALID_PARAMETER); return (ATOM)0; @@ -202,8 +202,8 @@ GlobalFindAtomW(LPCWSTR lpString) if (lstrlenW(lpString) > 255) { - /* This limit does not exist with NtAddAtom so the limit is probably - * added for compability. -Gunnar + /* This limit does not exist with NtAddAtom so the limit is probably + * added for compability. -Gunnar */ SetLastError(ERROR_INVALID_PARAMETER); return (ATOM)0; @@ -332,14 +332,14 @@ BOOL STDCALL InitAtomTable(DWORD nSize) { NTSTATUS Status; - + /* nSize should be a prime number */ - + if ( nSize < 4 || nSize >= 512 ) { nSize = 37; } - + if (LocalAtomTable == NULL) { Status = RtlCreateAtomTable(nSize, @@ -438,7 +438,7 @@ DeleteAtom(ATOM nAtom) { PRTL_ATOM_TABLE AtomTable; NTSTATUS Status; - + if (nAtom < 0xC000) { return 0; @@ -453,7 +453,7 @@ DeleteAtom(ATOM nAtom) SetLastErrorByStatus(Status); return nAtom; } - + return 0; } diff --git a/reactos/lib/kernel32/misc/chartype.c b/reactos/lib/kernel32/misc/chartype.c index 57b35a8d321..da917c45fa6 100644 --- a/reactos/lib/kernel32/misc/chartype.c +++ b/reactos/lib/kernel32/misc/chartype.c @@ -1892,7 +1892,7 @@ GetStringTypeW ( { 0xFFE8, 0xFFEE, C3_HALFWIDTH }, { 0xFFE8, 0xFFEE, C3_SYMBOL } }; - + if (-1 == Count) { Count = wcslen(Src) + 1; diff --git a/reactos/lib/kernel32/misc/comm.c b/reactos/lib/kernel32/misc/comm.c index 0f0c9f5c7d8..45de5e59bb9 100644 --- a/reactos/lib/kernel32/misc/comm.c +++ b/reactos/lib/kernel32/misc/comm.c @@ -12,10 +12,10 @@ * Created 01/11/98 * RDD (30/09/2002) implemented many function bodies to call serial driver. * KJK (11/02/2003) implemented BuildCommDCB & BuildCommDCBAndTimeouts - * ST (21/03/2005) implemented GetCommProperties + * ST (21/03/2005) implemented GetCommProperties * ST (24/03/2005) implemented ClearCommError. Corrected many functions. * ST (05/04/2005) implemented CommConfigDialog - * + * */ #include @@ -131,7 +131,7 @@ COMMDCB_ParseCharFlag(LPWSTR *StrTail, /* premature end of string, or the character is whitespace */ if(!wcFlag || iswspace(wcFlag)) return FALSE; - + /* uppercase the character for case-insensitive search */ wcFlag = towupper(wcFlag); @@ -149,7 +149,7 @@ COMMDCB_ParseCharFlag(LPWSTR *StrTail, if(nComparison == 0) { *Value = Flags[nCurFlag].Value; - + return TRUE; } else if(nComparison < 0) @@ -238,7 +238,7 @@ COMMDCB_ParseInt(LPWSTR *StrTail, { LPWSTR pwcPrevTail = *StrTail; DWORD nValue = wcstoul(*StrTail, StrTail, 10); - + /* no character was consumed: failure */ if(pwcPrevTail == *StrTail) return FALSE; @@ -253,7 +253,7 @@ COMMDCB_ParseInt(LPWSTR *StrTail, COMMDCB_PARAM_HANDLER(baud) { DWORD nValue; - + (void)Timeouts; /* parse the baudrate */ @@ -327,7 +327,7 @@ COMMDCB_PARAM_HANDLER(data) /* value out of range: failure */ if(nValue < 5 || nValue > 8) return FALSE; - + /* success */ Dcb->ByteSize = nValue; return TRUE; @@ -366,7 +366,7 @@ COMMDCB_PARAM_HANDLER(dtr) COMMDCB_PARAM_HANDLER(idsr) { BOOL bValue; - + (void)Timeouts; (void)StopBitsSet; @@ -711,7 +711,7 @@ BuildCommDCBAndTimeoutsA(LPCSTR lpDef, UNICODE_STRING wstrDef; RtlInitAnsiString(&strDef, (LPSTR)lpDef); - + Status = RtlAnsiStringToUnicodeString(&wstrDef, &strDef, TRUE); if(!NT_SUCCESS(Status)) @@ -719,11 +719,11 @@ BuildCommDCBAndTimeoutsA(LPCSTR lpDef, SetLastErrorByStatus(Status); return FALSE; } - + bRetVal = BuildCommDCBAndTimeoutsW(wstrDef.Buffer, lpDCB, lpCommTimeouts); RtlFreeUnicodeString(&wstrDef); - + return bRetVal; } @@ -757,7 +757,7 @@ STDCALL ClearCommBreak(HANDLE hFile) { DWORD dwBytesReturned; - return DeviceIoControl(hFile, IOCTL_SERIAL_SET_BREAK_OFF, + return DeviceIoControl(hFile, IOCTL_SERIAL_SET_BREAK_OFF, NULL, 0, NULL, 0, &dwBytesReturned, NULL); } @@ -772,15 +772,15 @@ ClearCommError(HANDLE hFile, LPDWORD lpErrors, LPCOMSTAT lpComStat) BOOL status = FALSE; DWORD dwBytesReturned; SERIAL_STATUS SerialStatus; - - status = DeviceIoControl(hFile, IOCTL_SERIAL_GET_COMMSTATUS, NULL, 0, + + status = DeviceIoControl(hFile, IOCTL_SERIAL_GET_COMMSTATUS, NULL, 0, &SerialStatus, sizeof(SERIAL_STATUS), &dwBytesReturned, NULL); - + if(!NT_SUCCESS(status)) { return status; } - + if(lpErrors) { *lpErrors = 0; @@ -795,11 +795,11 @@ ClearCommError(HANDLE hFile, LPDWORD lpErrors, LPCOMSTAT lpComStat) if(SerialStatus.Errors & SERIAL_ERROR_PARITY) *lpErrors |= CE_RXPARITY; } - - if (lpComStat) + + if (lpComStat) { ZeroMemory(lpComStat, sizeof(COMSTAT)); - + if(SerialStatus.HoldReasons & SERIAL_TX_WAITING_FOR_CTS) lpComStat->fCtsHold = TRUE; if(SerialStatus.HoldReasons & SERIAL_TX_WAITING_FOR_DSR) @@ -810,10 +810,10 @@ ClearCommError(HANDLE hFile, LPDWORD lpErrors, LPCOMSTAT lpComStat) lpComStat->fXoffHold = TRUE; if(SerialStatus.HoldReasons & SERIAL_TX_WAITING_XOFF_SENT) lpComStat->fXoffSent = TRUE; - + if(SerialStatus.EofReceived) lpComStat->fEof = TRUE; - + if(SerialStatus.WaitForImmediate) lpComStat->fTxim = TRUE; @@ -833,18 +833,18 @@ CommConfigDialogA(LPCSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC) { PWCHAR NameW; BOOL result; - + /* don't use the static thread buffer so operations in serialui don't overwrite the string */ if(!(NameW = FilenameA2W(lpszName, TRUE))) { return FALSE; } - + result = CommConfigDialogW(NameW, hWnd, lpCC); RtlFreeHeap(RtlGetProcessHeap(), 0, NameW); - + return result; } @@ -859,23 +859,23 @@ CommConfigDialogW(LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC) BOOL (STDCALL *drvCommDlgW)(LPCWSTR, HWND, LPCOMMCONFIG); HMODULE hSerialuiDll; BOOL result; - + //FIXME: Get dll name from registry. (setupapi needed) if(!(hSerialuiDll = LoadLibraryW(L"serialui.dll"))) { DPRINT("CommConfigDialogW: serialui.dll not found.\n"); return FALSE; } - + drvCommDlgW = GetProcAddress(hSerialuiDll, "drvCommConfigDialogW"); - + if(!drvCommDlgW) { DPRINT("CommConfigDialogW: serialui does not export drvCommConfigDialogW\n"); FreeLibrary(hSerialuiDll); return FALSE; } - + result = drvCommDlgW(lpszName, hWnd, lpCC); FreeLibrary(hSerialuiDll); return result; @@ -893,28 +893,28 @@ EscapeCommFunction(HANDLE hFile, DWORD dwFunc) DWORD dwBytesReturned; switch (dwFunc) { - case CLRDTR: // Clears the DTR (data-terminal-ready) signal. + case CLRDTR: // Clears the DTR (data-terminal-ready) signal. result = DeviceIoControl(hFile, IOCTL_SERIAL_CLR_DTR, NULL, 0, NULL, 0, &dwBytesReturned, NULL); break; - case CLRRTS: // Clears the RTS (request-to-send) signal. + case CLRRTS: // Clears the RTS (request-to-send) signal. result = DeviceIoControl(hFile, IOCTL_SERIAL_CLR_RTS, NULL, 0, NULL, 0, &dwBytesReturned, NULL); break; - case SETDTR: // Sends the DTR (data-terminal-ready) signal. + case SETDTR: // Sends the DTR (data-terminal-ready) signal. result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_DTR, NULL, 0, NULL, 0, &dwBytesReturned, NULL); break; - case SETRTS: // Sends the RTS (request-to-send) signal. + case SETRTS: // Sends the RTS (request-to-send) signal. result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_RTS, NULL, 0, NULL, 0, &dwBytesReturned, NULL); break; - case SETXOFF: // Causes transmission to act as if an XOFF character has been received. + case SETXOFF: // Causes transmission to act as if an XOFF character has been received. result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_XOFF, NULL, 0, NULL, 0, &dwBytesReturned, NULL); break; - case SETXON: // Causes transmission to act as if an XON character has been received. + case SETXON: // Causes transmission to act as if an XON character has been received. result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_XON, NULL, 0, NULL, 0, &dwBytesReturned, NULL); break; - case SETBREAK: // Suspends character transmission and places the transmission line in a break state until the ClearCommBreak function is called (or EscapeCommFunction is called with the CLRBREAK extended function code). The SETBREAK extended function code is identical to the SetCommBreak function. Note that this extended function does not flush data that has not been transmitted. + case SETBREAK: // Suspends character transmission and places the transmission line in a break state until the ClearCommBreak function is called (or EscapeCommFunction is called with the CLRBREAK extended function code). The SETBREAK extended function code is identical to the SetCommBreak function. Note that this extended function does not flush data that has not been transmitted. result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_BREAK_ON, NULL, 0, NULL, 0, &dwBytesReturned, NULL); break; - case CLRBREAK: // Restores character transmission and places the transmission line in a nonbreak state. The CLRBREAK extended function code is identical to the ClearCommBreak function. + case CLRBREAK: // Restores character transmission and places the transmission line in a nonbreak state. The CLRBREAK extended function code is identical to the ClearCommBreak function. result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_BREAK_OFF, NULL, 0, NULL, 0, &dwBytesReturned, NULL); break; default: @@ -946,7 +946,7 @@ STDCALL GetCommMask(HANDLE hFile, LPDWORD lpEvtMask) { DWORD dwBytesReturned; - return DeviceIoControl(hFile, IOCTL_SERIAL_GET_WAIT_MASK, + return DeviceIoControl(hFile, IOCTL_SERIAL_GET_WAIT_MASK, NULL, 0, lpEvtMask, sizeof(DWORD), &dwBytesReturned, NULL); } @@ -973,7 +973,7 @@ STDCALL GetCommProperties(HANDLE hFile, LPCOMMPROP lpCommProp) { DWORD dwBytesReturned; - return DeviceIoControl(hFile, IOCTL_SERIAL_GET_PROPERTIES, 0, 0, + return DeviceIoControl(hFile, IOCTL_SERIAL_GET_PROPERTIES, 0, 0, lpCommProp, sizeof(COMMPROP), &dwBytesReturned, 0); } @@ -1001,7 +1001,7 @@ GetCommState(HANDLE hFile, LPDCB lpDCB) } lpDCB->DCBlength = sizeof(DCB); - + /* FIXME: need to fill following fields (1 bit): * fBinary: binary mode, no EOF check * fParity: enable parity checking @@ -1100,10 +1100,10 @@ GetCommTimeouts(HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts) if (lpCommTimeouts == NULL) { return FALSE; } - + return DeviceIoControl(hFile, IOCTL_SERIAL_GET_TIMEOUTS, - NULL, 0, - lpCommTimeouts, sizeof(COMMTIMEOUTS), + NULL, 0, + lpCommTimeouts, sizeof(COMMTIMEOUTS), &dwBytesReturned, NULL); } @@ -1141,7 +1141,7 @@ PurgeComm(HANDLE hFile, DWORD dwFlags) { DWORD dwBytesReturned; - return DeviceIoControl(hFile, IOCTL_SERIAL_PURGE, + return DeviceIoControl(hFile, IOCTL_SERIAL_PURGE, &dwFlags, sizeof(DWORD), NULL, 0, &dwBytesReturned, NULL); } @@ -1180,7 +1180,7 @@ SetCommMask(HANDLE hFile, DWORD dwEvtMask) { DWORD dwBytesReturned; - return DeviceIoControl(hFile, IOCTL_SERIAL_SET_WAIT_MASK, + return DeviceIoControl(hFile, IOCTL_SERIAL_SET_WAIT_MASK, &dwEvtMask, sizeof(DWORD), NULL, 0, &dwBytesReturned, NULL); } @@ -1330,7 +1330,7 @@ SetCommTimeouts(HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts) Timeouts.ReadTotalTimeoutConstant = lpCommTimeouts->ReadTotalTimeoutConstant; Timeouts.WriteTotalTimeoutMultiplier = lpCommTimeouts->WriteTotalTimeoutMultiplier; Timeouts.WriteTotalTimeoutConstant = lpCommTimeouts->WriteTotalTimeoutConstant; - + return DeviceIoControl(hFile, IOCTL_SERIAL_SET_TIMEOUTS, &Timeouts, sizeof(Timeouts), NULL, 0, &dwBytesReturned, NULL); } @@ -1402,7 +1402,7 @@ WaitCommEvent(HANDLE hFile, LPDWORD lpEvtMask, LPOVERLAPPED lpOverlapped) if (lpEvtMask == NULL) { return FALSE; } - + return DeviceIoControl(hFile, IOCTL_SERIAL_WAIT_ON_MASK, NULL, 0, lpEvtMask, sizeof(DWORD), &dwBytesReturned, lpOverlapped); } diff --git a/reactos/lib/kernel32/misc/computername.c b/reactos/lib/kernel32/misc/computername.c index 60bb9bc5ef9..3e100ccb08f 100644 --- a/reactos/lib/kernel32/misc/computername.c +++ b/reactos/lib/kernel32/misc/computername.c @@ -37,7 +37,7 @@ static BOOL GetComputerNameFromRegistry( LPWSTR RegistryKey, LPWSTR ValueNameStr, - LPWSTR lpBuffer, + LPWSTR lpBuffer, LPDWORD nSize ) { PKEY_VALUE_PARTIAL_INFORMATION KeyInfo; OBJECT_ATTRIBUTES ObjectAttributes; @@ -47,7 +47,7 @@ static BOOL GetComputerNameFromRegistry( LPWSTR RegistryKey, ULONG KeyInfoSize; ULONG ReturnSize; NTSTATUS Status; - + RtlInitUnicodeString (&KeyName,RegistryKey); InitializeObjectAttributes (&ObjectAttributes, &KeyName, @@ -62,7 +62,7 @@ static BOOL GetComputerNameFromRegistry( LPWSTR RegistryKey, SetLastErrorByStatus (Status); return FALSE; } - + KeyInfoSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + *nSize * sizeof(WCHAR); KeyInfo = RtlAllocateHeap (RtlGetProcessHeap (), @@ -74,9 +74,9 @@ static BOOL GetComputerNameFromRegistry( LPWSTR RegistryKey, SetLastError (ERROR_OUTOFMEMORY); return FALSE; } - + RtlInitUnicodeString (&ValueName,ValueNameStr); - + Status = ZwQueryValueKey (KeyHandle, &ValueName, KeyValuePartialInformation, @@ -92,7 +92,7 @@ static BOOL GetComputerNameFromRegistry( LPWSTR RegistryKey, SetLastErrorByStatus (Status); return FALSE; } - + if( *nSize > (KeyInfo->DataLength / sizeof(WCHAR)) ) { *nSize = KeyInfo->DataLength / sizeof(WCHAR); lpBuffer[*nSize] = 0; @@ -107,7 +107,7 @@ static BOOL GetComputerNameFromRegistry( LPWSTR RegistryKey, KeyInfo) ; ZwClose (KeyHandle); - + return TRUE; } @@ -124,14 +124,14 @@ GetComputerNameExW ( UNICODE_STRING ResultString; UNICODE_STRING DomainPart, Dot; UNICODE_STRING RegKey, RegValue; - + switch( NameType ) { - case ComputerNameNetBIOS: + case ComputerNameNetBIOS: return GetComputerNameFromRegistry ( L"\\Registry\\Machine\\System\\CurrentControlSet" L"\\Control\\ComputerName\\ComputerName", L"ComputerName", - lpBuffer, + lpBuffer, nSize ); case ComputerNameDnsDomain: @@ -139,7 +139,7 @@ GetComputerNameExW ( ( L"\\Registry\\Machine\\System\\CurrentControlSet" L"\\Services\\Tcpip\\Parameters", L"Domain", - lpBuffer, + lpBuffer, nSize ); case ComputerNameDnsFullyQualified: @@ -172,20 +172,20 @@ GetComputerNameExW ( ( L"\\Registry\\Machine\\System\\CurrentControlSet" L"\\Services\\Tcpip\\Parameters", L"Hostname", - lpBuffer, + lpBuffer, nSize ); - + case ComputerNamePhysicalDnsDomain: return GetComputerNameFromRegistry ( L"\\Registry\\Machine\\System\\CurrentControlSet" L"\\Services\\Tcpip\\Parameters", L"Domain", - lpBuffer, + lpBuffer, nSize ); /* XXX Redo these */ case ComputerNamePhysicalDnsFullyQualified: - return GetComputerNameExW( ComputerNameDnsFullyQualified, + return GetComputerNameExW( ComputerNameDnsFullyQualified, lpBuffer, nSize ); case ComputerNamePhysicalDnsHostname: return GetComputerNameExW( ComputerNameDnsHostname, @@ -216,7 +216,7 @@ GetComputerNameExA ( ANSI_STRING AnsiString; BOOL Result; PWCHAR TempBuffer = RtlAllocateHeap( GetProcessHeap(), 0, *nSize * sizeof(WCHAR) ); - + if( !TempBuffer ) { return ERROR_OUTOFMEMORY; } @@ -231,14 +231,14 @@ GetComputerNameExA ( UnicodeString.MaximumLength = *nSize * sizeof(WCHAR); UnicodeString.Length = *nSize * sizeof(WCHAR); UnicodeString.Buffer = TempBuffer; - + RtlUnicodeStringToAnsiString (&AnsiString, &UnicodeString, FALSE); } HeapFree( GetProcessHeap(), 0, TempBuffer ); - + return Result; } diff --git a/reactos/lib/kernel32/misc/console.c b/reactos/lib/kernel32/misc/console.c index 4033316d6cf..eb63559152e 100644 --- a/reactos/lib/kernel32/misc/console.c +++ b/reactos/lib/kernel32/misc/console.c @@ -4,7 +4,7 @@ * PROJECT: ReactOS system libraries * FILE: lib/kernel32/misc/console.c * PURPOSE: Win32 server console functions - * PROGRAMMER: James Tabor + * PROGRAMMER: James Tabor * * UPDATE HISTORY: * 199901?? ?? Created @@ -42,7 +42,7 @@ BOOL WINAPI DefaultConsoleCtrlHandler(DWORD Event) case CTRL_C_EVENT: DPRINT("Ctrl-C Event\n"); break; - + case CTRL_BREAK_EVENT: DPRINT("Ctrl-Break Event\n"); break; @@ -55,7 +55,7 @@ BOOL WINAPI DefaultConsoleCtrlHandler(DWORD Event) DPRINT("Ctrl Close Event\n"); break; - case CTRL_LOGOFF_EVENT: + case CTRL_LOGOFF_EVENT: DPRINT("Ctrl Logoff Event\n"); break; } @@ -80,14 +80,14 @@ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); if(IsDebuggerPresent()) { EXCEPTION_RECORD erException; - erException.ExceptionCode = + erException.ExceptionCode = (nCode == CTRL_C_EVENT ? DBG_CONTROL_C : DBG_CONTROL_BREAK); erException.ExceptionFlags = 0; erException.ExceptionRecord = NULL; erException.ExceptionAddress = &DefaultConsoleCtrlHandler; erException.NumberParameters = 0; RtlRaiseException(&erException); - } + } RtlEnterCriticalSection(&ConsoleLock); if(!(nCode == CTRL_C_EVENT && @@ -115,7 +115,7 @@ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); i = NrCtrlHandlers; while(i > 0) { - if (i == 1 && (CodeAndFlag & MINLONG) && + if (i == 1 && (CodeAndFlag & MINLONG) && (nCode == CTRL_LOGOFF_EVENT || nCode == CTRL_SHUTDOWN_EVENT)) break; @@ -203,7 +203,7 @@ DuplicateConsoleHandle (HANDLE hConsole, SetLastError (ERROR_INVALID_PARAMETER); return INVALID_HANDLE_VALUE; } - + Request.Type = CSRSS_DUPLICATE_HANDLE; Request.Data.DuplicateHandleRequest.Handle = hConsole; Request.Data.DuplicateHandleRequest.ProcessId = GetTeb()->Cid.UniqueProcess; @@ -364,7 +364,7 @@ GetConsoleAliasesW (DWORD Unknown0, SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return 0; } - + /* * @unimplemented @@ -555,7 +555,7 @@ GetConsoleHardwareState (HANDLE hConsole, return FALSE; } *State = Reply.Data.ConsoleHardwareStateReply.State; - return TRUE; + return TRUE; } @@ -645,7 +645,7 @@ OpenConsoleW (LPWSTR wsName, CSRSS_API_REPLY Reply; PHANDLE phConsole = NULL; NTSTATUS Status = STATUS_SUCCESS; - + if(0 == _wcsicmp(wsName, L"CONIN$")) { Request.Type = CSRSS_GET_INPUT_HANDLE; @@ -781,7 +781,7 @@ SetConsoleHardwareState (HANDLE hConsole, SetLastErrorByStatus(Status); return FALSE; } - return TRUE; + return TRUE; } @@ -1117,7 +1117,7 @@ IntWriteConsole(HANDLE hConsoleOutput, USHORT nChars; ULONG MessageSize, BufferSize, SizeBytes, CharSize; DWORD Written = 0; - + CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); BufferSize = sizeof(CSRSS_API_REQUEST) + min(nNumberOfCharsToWrite * CharSize, CSRSS_MAX_WRITE_CONSOLE_REQUEST); @@ -1160,7 +1160,7 @@ IntWriteConsole(HANDLE hConsoleOutput, } RtlFreeHeap(GetProcessHeap(), 0, Request); - + if(lpNumberOfCharsWritten != NULL) { *lpNumberOfCharsWritten = Written; @@ -1175,7 +1175,7 @@ IntWriteConsole(HANDLE hConsoleOutput, * * @implemented */ -BOOL STDCALL +BOOL STDCALL WriteConsoleA(HANDLE hConsoleOutput, CONST VOID *lpBuffer, DWORD nNumberOfCharsToWrite, @@ -1226,9 +1226,9 @@ IntReadConsole(HANDLE hConsoleInput, PCSRSS_API_REPLY Reply; NTSTATUS Status; ULONG BufferSize, CharSize, CharsRead = 0; - + CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); - + BufferSize = sizeof(CSRSS_API_REQUEST) + min(nNumberOfCharsToRead * CharSize, CSRSS_MAX_READ_CONSOLE_REQUEST); Reply = RtlAllocateHeap(GetProcessHeap(), 0, BufferSize); if(Reply == NULL) @@ -1236,7 +1236,7 @@ IntReadConsole(HANDLE hConsoleInput, SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } - + Reply->Status = STATUS_SUCCESS; do @@ -1250,7 +1250,7 @@ IntReadConsole(HANDLE hConsoleInput, break; } } - + Request.Type = CSRSS_READ_CONSOLE; Request.Data.ReadConsoleRequest.ConsoleHandle = hConsoleInput; Request.Data.ReadConsoleRequest.Unicode = bUnicode; @@ -1268,13 +1268,13 @@ IntReadConsole(HANDLE hConsoleInput, RtlFreeHeap(GetProcessHeap(), 0, Reply); return FALSE; } - + nNumberOfCharsToRead -= Reply->Data.ReadConsoleReply.NrCharactersRead; memcpy((PVOID)((ULONG_PTR)lpBuffer + (ULONG_PTR)(CharsRead * CharSize)), Reply->Data.ReadConsoleReply.Buffer, Reply->Data.ReadConsoleReply.NrCharactersRead * CharSize); CharsRead += Reply->Data.ReadConsoleReply.NrCharactersRead; - + if(Reply->Status == STATUS_NOTIFY_CLEANUP) { if(CharsRead > 0) @@ -1285,12 +1285,12 @@ IntReadConsole(HANDLE hConsoleInput, Reply->Status = STATUS_PENDING; } } while(Reply->Status == STATUS_PENDING && nNumberOfCharsToRead > 0); - + if(lpNumberOfCharsRead != NULL) { *lpNumberOfCharsRead = CharsRead; } - + return TRUE; } @@ -1352,8 +1352,8 @@ BOOL STDCALL AllocConsole(VOID) if(NtCurrentPeb()->ProcessParameters->hConsole) { DPRINT("AllocConsole: Allocate duplicate console to the same Process\n"); - SetLastErrorByStatus (STATUS_OBJECT_NAME_EXISTS); - return FALSE; + SetLastErrorByStatus (STATUS_OBJECT_NAME_EXISTS); + return FALSE; } Request.Data.AllocConsoleRequest.CtrlDispatcher = ConsoleControlDispatcher; @@ -1496,7 +1496,7 @@ IntFillConsoleOutputCharacter(HANDLE hConsoleOutput, { *lpNumberOfCharsWritten = Reply.Data.FillOutputReply.NrCharactersWritten; } - + return TRUE; } @@ -1560,13 +1560,13 @@ IntPeekConsoleInput(HANDLE hConsoleInput, PVOID BufferBase; PVOID BufferTargetBase; ULONG Size; - + if(lpBuffer == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + Size = nLength * sizeof(INPUT_RECORD); Status = CsrCaptureParameterBuffer(NULL, Size, &BufferBase, &BufferTargetBase); @@ -1575,7 +1575,7 @@ IntPeekConsoleInput(HANDLE hConsoleInput, SetLastErrorByStatus(Status); return FALSE; } - + Request = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CSRSS_API_REQUEST)); if(Request == NULL) { @@ -1583,17 +1583,17 @@ IntPeekConsoleInput(HANDLE hConsoleInput, SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } - + Request->Type = CSRSS_PEEK_CONSOLE_INPUT; Request->Data.PeekConsoleInputRequest.ConsoleHandle = hConsoleInput; Request->Data.PeekConsoleInputRequest.Unicode = bUnicode; Request->Data.PeekConsoleInputRequest.Length = nLength; Request->Data.PeekConsoleInputRequest.InputRecord = (INPUT_RECORD*)BufferTargetBase; - + Status = CsrClientCallServer(Request, &Reply, sizeof(CSRSS_API_REQUEST), sizeof(CSRSS_API_REPLY)); - + if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status)) { RtlFreeHeap(GetProcessHeap(), 0, Request); @@ -1605,12 +1605,12 @@ IntPeekConsoleInput(HANDLE hConsoleInput, RtlFreeHeap(GetProcessHeap(), 0, Request); CsrReleaseParameterBuffer(BufferBase); - + if(lpNumberOfEventsRead != NULL) { *lpNumberOfEventsRead = Reply.Data.PeekConsoleInputReply.Length; } - + return TRUE; } @@ -1645,7 +1645,7 @@ PeekConsoleInputW( PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead - ) + ) { return IntPeekConsoleInput(hConsoleInput, lpBuffer, nLength, lpNumberOfEventsRead, TRUE); @@ -1663,7 +1663,7 @@ IntReadConsoleInput(HANDLE hConsoleInput, CSRSS_API_REPLY Reply; ULONG Read; NTSTATUS Status; - + Request.Type = CSRSS_READ_INPUT; Request.Data.ReadInputRequest.ConsoleHandle = hConsoleInput; Request.Data.ReadInputRequest.Unicode = bUnicode; @@ -1717,12 +1717,12 @@ IntReadConsoleInput(HANDLE hConsoleInput, } } } - + if(lpNumberOfEventsRead != NULL) { *lpNumberOfEventsRead = Read; } - + return (Read > 0); } @@ -1801,13 +1801,13 @@ IntWriteConsoleInput(HANDLE hConsoleInput, sizeof(CSRSS_API_REPLY)); CsrReleaseParameterBuffer(BufferBase); - + if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status)) { SetLastErrorByStatus(Status); return FALSE; } - + if(lpNumberOfEventsWritten != NULL) { *lpNumberOfEventsWritten = Reply.Data.WriteConsoleInputReply.Length; @@ -1875,13 +1875,13 @@ IntReadConsoleOutput(HANDLE hConsoleOutput, PVOID BufferTargetBase; NTSTATUS Status; DWORD Size, SizeX, SizeY; - + if(lpBuffer == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + Size = dwBufferSize.X * dwBufferSize.Y * sizeof(CHAR_INFO); Status = CsrCaptureParameterBuffer(NULL, Size, &BufferBase, &BufferTargetBase); @@ -1890,7 +1890,7 @@ IntReadConsoleOutput(HANDLE hConsoleOutput, SetLastErrorByStatus(Status); return FALSE; } - + Request = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CSRSS_API_REQUEST)); if(Request == NULL) { @@ -1898,7 +1898,7 @@ IntReadConsoleOutput(HANDLE hConsoleOutput, CsrReleaseParameterBuffer(BufferBase); return FALSE; } - + Request->Type = CSRSS_READ_CONSOLE_OUTPUT; Request->Data.ReadConsoleOutputRequest.ConsoleHandle = hConsoleOutput; Request->Data.ReadConsoleOutputRequest.Unicode = bUnicode; @@ -1906,7 +1906,7 @@ IntReadConsoleOutput(HANDLE hConsoleOutput, Request->Data.ReadConsoleOutputRequest.BufferCoord = dwBufferCoord; Request->Data.ReadConsoleOutputRequest.ReadRegion = *lpReadRegion; Request->Data.ReadConsoleOutputRequest.CharInfo = (PCHAR_INFO)BufferTargetBase; - + Status = CsrClientCallServer(Request, &Reply, sizeof(CSRSS_API_REQUEST), sizeof(CSRSS_API_REPLY)); @@ -1918,17 +1918,17 @@ IntReadConsoleOutput(HANDLE hConsoleOutput, CsrReleaseParameterBuffer(BufferBase); return FALSE; } - + SizeX = Reply.Data.ReadConsoleOutputReply.ReadRegion.Right - Reply.Data.ReadConsoleOutputReply.ReadRegion.Left + 1; SizeY = Reply.Data.ReadConsoleOutputReply.ReadRegion.Bottom - Reply.Data.ReadConsoleOutputReply.ReadRegion.Top + 1; - + memcpy(lpBuffer, BufferBase, sizeof(CHAR_INFO) * SizeX * SizeY); - + RtlFreeHeap(GetProcessHeap(), 0, Request); CsrReleaseParameterBuffer(BufferBase); - + *lpReadRegion = Reply.Data.ReadConsoleOutputReply.ReadRegion; - + return TRUE; } @@ -1998,8 +1998,8 @@ IntWriteConsoleOutput(HANDLE hConsoleOutput, SetLastErrorByStatus(Status); return(FALSE); } - - Request = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, + + Request = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CSRSS_API_REQUEST)); if (Request == NULL) { @@ -2013,11 +2013,11 @@ IntWriteConsoleOutput(HANDLE hConsoleOutput, Request->Data.WriteConsoleOutputRequest.BufferSize = dwBufferSize; Request->Data.WriteConsoleOutputRequest.BufferCoord = dwBufferCoord; Request->Data.WriteConsoleOutputRequest.WriteRegion = *lpWriteRegion; - Request->Data.WriteConsoleOutputRequest.CharInfo = + Request->Data.WriteConsoleOutputRequest.CharInfo = (CHAR_INFO*)BufferTargetBase; - - Status = CsrClientCallServer(Request, &Reply, - sizeof(CSRSS_API_REQUEST), + + Status = CsrClientCallServer(Request, &Reply, + sizeof(CSRSS_API_REQUEST), sizeof(CSRSS_API_REPLY)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status)) @@ -2027,12 +2027,12 @@ IntWriteConsoleOutput(HANDLE hConsoleOutput, SetLastErrorByStatus(Status); return FALSE; } - + RtlFreeHeap(GetProcessHeap(), 0, Request); CsrReleaseParameterBuffer(BufferBase); - + *lpWriteRegion = Reply.Data.WriteConsoleOutputReply.WriteRegion; - + return(TRUE); } @@ -2086,9 +2086,9 @@ IntReadConsoleOutputCharacter(HANDLE hConsoleOutput, NTSTATUS Status; ULONG nChars, SizeBytes, CharSize; DWORD CharsRead = 0; - + CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); - + nChars = min(nLength, CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR / CharSize); SizeBytes = nChars * CharSize; @@ -2109,7 +2109,7 @@ IntReadConsoleOutputCharacter(HANDLE hConsoleOutput, while(nLength > 0) { DWORD BytesRead; - + Request.Data.ReadConsoleOutputCharRequest.NumCharsToRead = min(nLength, nChars); Status = CsrClientCallServer(&Request, @@ -2127,12 +2127,12 @@ IntReadConsoleOutputCharacter(HANDLE hConsoleOutput, lpCharacter = (PVOID)((ULONG_PTR)lpCharacter + (ULONG_PTR)BytesRead); CharsRead += Reply->Data.ReadConsoleOutputCharReply.CharsRead; nLength -= Reply->Data.ReadConsoleOutputCharReply.CharsRead; - + Request.Data.ReadConsoleOutputCharRequest.ReadCoord = Reply->Data.ReadConsoleOutputCharReply.EndCoord; } RtlFreeHeap(GetProcessHeap(), 0, Reply); - + if(lpNumberOfCharsRead != NULL) { *lpNumberOfCharsRead = CharsRead; @@ -2209,7 +2209,7 @@ ReadConsoleOutputAttribute( PCSRSS_API_REPLY Reply; NTSTATUS Status; DWORD Size, i; - + Reply = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(CSRSS_API_REPLY) + min(nLength, CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB)); if (Reply == NULL) @@ -2248,7 +2248,7 @@ ReadConsoleOutputAttribute( // Convert CHARs to WORDs for(i = 0; i < Size; ++i) *lpAttribute++ = Reply->Data.ReadConsoleOutputAttribReply.String[i]; - + nLength -= Size; Request.Data.ReadConsoleOutputAttribRequest.ReadCoord = Reply->Data.ReadConsoleOutputAttribReply.EndCoord; } @@ -2272,9 +2272,9 @@ IntWriteConsoleOutputCharacter(HANDLE hConsoleOutput, NTSTATUS Status; ULONG SizeBytes, CharSize, nChars; DWORD Written = 0; - + CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); - + nChars = min(nLength, CSRSS_MAX_WRITE_CONSOLE_REQUEST / CharSize); SizeBytes = nChars * CharSize; @@ -2294,7 +2294,7 @@ IntWriteConsoleOutputCharacter(HANDLE hConsoleOutput, while(nLength > 0) { DWORD BytesWrite; - + Request->Data.WriteConsoleOutputCharRequest.Length = min(nLength, nChars); BytesWrite = Request->Data.WriteConsoleOutputCharRequest.Length * CharSize; @@ -2319,7 +2319,7 @@ IntWriteConsoleOutputCharacter(HANDLE hConsoleOutput, } RtlFreeHeap(GetProcessHeap(), 0, Request); - + if(lpNumberOfCharsWritten != NULL) { *lpNumberOfCharsWritten = Written; @@ -2422,7 +2422,7 @@ WriteConsoleOutputAttribute( lpAttribute += Size; Request->Data.WriteConsoleOutputAttribRequest.Coord = Reply.Data.WriteConsoleOutputAttribReply.EndCoord; } - + RtlFreeHeap( GetProcessHeap(), 0, Request ); return TRUE; } @@ -2479,7 +2479,7 @@ GetConsoleMode( CSRSS_API_REQUEST Request; CSRSS_API_REPLY Reply; NTSTATUS Status; - + Request.Type = CSRSS_GET_CONSOLE_MODE; Request.Data.GetConsoleModeRequest.ConsoleHandle = hConsoleHandle; Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); @@ -2508,13 +2508,13 @@ GetNumberOfConsoleInputEvents( CSRSS_API_REQUEST Request; CSRSS_API_REPLY Reply; NTSTATUS Status; - + if(lpNumberOfEvents == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + Request.Type = CSRSS_GET_NUM_INPUT_EVENTS; Request.Data.GetNumInputEventsRequest.ConsoleHandle = hConsoleInput; Status = CsrClientCallServer(&Request, &Reply, sizeof(CSRSS_API_REQUEST), sizeof(CSRSS_API_REPLY)); @@ -2523,9 +2523,9 @@ GetNumberOfConsoleInputEvents( SetLastErrorByStatus(Status); return FALSE; } - + *lpNumberOfEvents = Reply.Data.GetNumInputEventsReply.NumInputEvents; - + return TRUE; } @@ -2610,7 +2610,7 @@ SetConsoleMode( CSRSS_API_REQUEST Request; CSRSS_API_REPLY Reply; NTSTATUS Status; - + Request.Type = CSRSS_SET_CONSOLE_MODE; Request.Data.SetConsoleModeRequest.ConsoleHandle = hConsoleHandle; Request.Data.SetConsoleModeRequest.Mode = dwMode; @@ -2878,13 +2878,13 @@ AddConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine) if (CtrlHandlers == NULL) { CtrlHandlers = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, - NrCtrlHandlers * sizeof(PHANDLER_ROUTINE)); + NrCtrlHandlers * sizeof(PHANDLER_ROUTINE)); } else { CtrlHandlers = RtlReAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, (PVOID)CtrlHandlers, - NrCtrlHandlers * sizeof(PHANDLER_ROUTINE)); + NrCtrlHandlers * sizeof(PHANDLER_ROUTINE)); } if (CtrlHandlers == NULL) { @@ -2915,9 +2915,9 @@ RemoveConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine) if ( ((void*)(CtrlHandlers[i])) == (void*)HandlerRoutine) { NrCtrlHandlers--; - memmove(CtrlHandlers + i, CtrlHandlers + i + 1, + memmove(CtrlHandlers + i, CtrlHandlers + i + 1, (NrCtrlHandlers - i) * sizeof(PHANDLER_ROUTINE)); - CtrlHandlers = + CtrlHandlers = RtlReAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, (PVOID)CtrlHandlers, @@ -2996,14 +2996,14 @@ GetConsoleTitleW( Reply = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CSRSS_API_REPLY) + CSRSS_MAX_TITLE_LENGTH * sizeof(WCHAR)); if(Reply == NULL) { - CloseHandle(hConsole); + CloseHandle(hConsole); SetLastError(ERROR_OUTOFMEMORY); return 0; } Request.Type = CSRSS_GET_TITLE; Request.Data.GetTitleRequest.ConsoleHandle = hConsole; - + Status = CsrClientCallServer(&Request, Reply, sizeof(CSRSS_API_REQUEST), sizeof(CSRSS_API_REPLY) + CSRSS_MAX_TITLE_LENGTH * sizeof(WCHAR)); CloseHandle(hConsole); if(!NT_SUCCESS(Status) || !(NT_SUCCESS(Status = Reply->Status))) @@ -3012,19 +3012,19 @@ GetConsoleTitleW( RtlFreeHeap(GetProcessHeap(), 0, Reply); return 0; } - + if(nSize * sizeof(WCHAR) < Reply->Data.GetTitleReply.Length) { wcsncpy(lpConsoleTitle, Reply->Data.GetTitleReply.Title, nSize - 1); lpConsoleTitle[nSize--] = L'\0'; } else - { + { nSize = Reply->Data.GetTitleReply.Length / sizeof (WCHAR); wcscpy(lpConsoleTitle, Reply->Data.GetTitleReply.Title); lpConsoleTitle[nSize] = L'\0'; } - + RtlFreeHeap(GetProcessHeap(), 0, Reply); return nSize; } @@ -3047,18 +3047,18 @@ GetConsoleTitleA( wchar_t WideTitle [CSRSS_MAX_TITLE_LENGTH]; DWORD nWideTitle = sizeof WideTitle; DWORD nWritten; - + if (!lpConsoleTitle || !nSize) return 0; nWideTitle = GetConsoleTitleW( (LPWSTR) WideTitle, nWideTitle ); if (!nWideTitle) return 0; if ( (nWritten = WideCharToMultiByte( - CP_ACP, // ANSI code page - 0, // performance and mapping flags - (LPWSTR) WideTitle, // address of wide-character string - nWideTitle, // number of characters in string - lpConsoleTitle, // address of buffer for new string - nSize, // size of buffer + CP_ACP, // ANSI code page + 0, // performance and mapping flags + (LPWSTR) WideTitle, // address of wide-character string + nWideTitle, // number of characters in string + lpConsoleTitle, // address of buffer for new string + nSize, // size of buffer NULL, // FAST NULL // FAST ))) @@ -3093,7 +3093,7 @@ SetConsoleTitleW( { return FALSE; } - + Request = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CSRSS_API_REQUEST) + CSRSS_MAX_SET_TITLE_REQUEST); @@ -3103,18 +3103,18 @@ SetConsoleTitleW( SetLastError(ERROR_OUTOFMEMORY); return(FALSE); } - + Request->Type = CSRSS_SET_TITLE; Request->Data.SetTitleRequest.Console = hConsole; - + for( c = 0; lpConsoleTitle[c] && c < CSRSS_MAX_TITLE_LENGTH; c++ ) Request->Data.SetTitleRequest.Title[c] = lpConsoleTitle[c]; // add null Request->Data.SetTitleRequest.Title[c] = 0; - Request->Data.SetTitleRequest.Length = c; + Request->Data.SetTitleRequest.Length = c; Status = CsrClientCallServer(Request, &Reply, - sizeof(CSRSS_API_REQUEST) + + sizeof(CSRSS_API_REQUEST) + c * sizeof(WCHAR), sizeof(CSRSS_API_REPLY)); CloseHandle(hConsole); @@ -3131,7 +3131,7 @@ SetConsoleTitleW( /*-------------------------------------------------------------- * SetConsoleTitleA - * + * * 19990204 EA Added * * @implemented @@ -3153,7 +3153,7 @@ SetConsoleTitleA( { return FALSE; } - + Request = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CSRSS_API_REQUEST) + CSRSS_MAX_SET_TITLE_REQUEST); @@ -3163,10 +3163,10 @@ SetConsoleTitleA( SetLastError(ERROR_OUTOFMEMORY); return(FALSE); } - + Request->Type = CSRSS_SET_TITLE; Request->Data.SetTitleRequest.Console = hConsole; - + for( c = 0; lpConsoleTitle[c] && c < CSRSS_MAX_TITLE_LENGTH; c++ ) Request->Data.SetTitleRequest.Title[c] = lpConsoleTitle[c]; // add null @@ -3174,7 +3174,7 @@ SetConsoleTitleA( Request->Data.SetTitleRequest.Length = c; Status = CsrClientCallServer(Request, &Reply, - sizeof(CSRSS_API_REQUEST) + + sizeof(CSRSS_API_REQUEST) + c * sizeof(WCHAR), sizeof(CSRSS_API_REPLY)); CloseHandle(hConsole); @@ -3232,7 +3232,7 @@ GetConsoleCP( VOID ) CSRSS_API_REQUEST Request; CSRSS_API_REPLY Reply; NTSTATUS Status; - + Request.Type = CSRSS_GET_CONSOLE_CP; Status = CsrClientCallServer(&Request, &Reply, sizeof(CSRSS_API_REQUEST), sizeof(CSRSS_API_REPLY)); @@ -3259,7 +3259,7 @@ SetConsoleCP( CSRSS_API_REQUEST Request; CSRSS_API_REPLY Reply; NTSTATUS Status; - + Request.Type = CSRSS_SET_CONSOLE_CP; Request.Data.SetConsoleCodePage.CodePage = wCodePageID; Status = CsrClientCallServer(&Request, &Reply, sizeof(CSRSS_API_REQUEST), @@ -3284,7 +3284,7 @@ GetConsoleOutputCP( VOID ) CSRSS_API_REQUEST Request; CSRSS_API_REPLY Reply; NTSTATUS Status; - + Request.Type = CSRSS_GET_CONSOLE_OUTPUT_CP; Status = CsrClientCallServer(&Request, &Reply, sizeof(CSRSS_API_REQUEST), sizeof(CSRSS_API_REPLY)); @@ -3311,7 +3311,7 @@ SetConsoleOutputCP( CSRSS_API_REQUEST Request; CSRSS_API_REPLY Reply; NTSTATUS Status; - + Request.Type = CSRSS_SET_CONSOLE_OUTPUT_CP; Request.Data.SetConsoleOutputCodePage.CodePage = wCodePageID; Status = CsrClientCallServer(&Request, &Reply, sizeof(CSRSS_API_REQUEST), @@ -3337,7 +3337,7 @@ GetConsoleProcessList(LPDWORD lpdwProcessList, PCSRSS_API_REPLY Reply; ULONG BufferSize, nProcesses; NTSTATUS Status; - + if(lpdwProcessList == NULL || dwProcessCount == 0) { SetLastError(ERROR_INVALID_PARAMETER); @@ -3355,10 +3355,10 @@ GetConsoleProcessList(LPDWORD lpdwProcessList, } Reply->Status = STATUS_SUCCESS; - + Request.Type = CSRSS_GET_PROCESS_LIST; Request.Data.GetProcessListRequest.nMaxIds = dwProcessCount; - + Status = CsrClientCallServer(&Request, Reply, sizeof(CSRSS_API_REQUEST), BufferSize); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply->Status)) @@ -3381,7 +3381,7 @@ GetConsoleProcessList(LPDWORD lpdwProcessList, nProcesses = Reply->Data.GetProcessListReply.nProcessIdsTotal; } } - + RtlFreeHeap(GetProcessHeap(), 0, Reply); return nProcesses; } @@ -3408,7 +3408,7 @@ GetConsoleSelectionInfo(PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo) * * @unimplemented */ -BOOL STDCALL +BOOL STDCALL AttachConsole(DWORD dwProcessId) { DPRINT1("AttachConsole(0x%x) UNIMPLEMENTED!\n", dwProcessId); @@ -3427,7 +3427,7 @@ GetConsoleWindow (VOID) CSRSS_API_REQUEST Request; CSRSS_API_REPLY Reply; NTSTATUS Status; - + Request.Type = CSRSS_GET_CONSOLE_WINDOW; Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); if (!NT_SUCCESS(Status ) || !NT_SUCCESS(Status = Reply.Status)) @@ -3449,7 +3449,7 @@ BOOL STDCALL SetConsoleIcon(HICON hicon) CSRSS_API_REQUEST Request; CSRSS_API_REPLY Reply; NTSTATUS Status; - + Request.Type = CSRSS_SET_CONSOLE_ICON; Request.Data.SetConsoleIconRequest.WindowIcon = hicon; Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); @@ -3480,7 +3480,7 @@ SetConsoleInputExeNameW(LPCWSTR lpInputExeName) SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + RtlEnterCriticalSection(&ConsoleLock); /* wrap copying into SEH as we may copy from invalid buffer and in case of an exception the console lock would've never been released, which would cause @@ -3499,7 +3499,7 @@ SetConsoleInputExeNameW(LPCWSTR lpInputExeName) } _SEH_END; RtlLeaveCriticalSection(&ConsoleLock); - + return Ret; } @@ -3516,9 +3516,9 @@ SetConsoleInputExeNameA(LPCSTR lpInputExeName) UNICODE_STRING InputExeNameU; NTSTATUS Status; BOOL Ret; - + RtlInitAnsiString(&InputExeNameA, lpInputExeName); - + if(InputExeNameA.Length < sizeof(InputExeNameA.Buffer[0]) || InputExeNameA.Length >= (sizeof(InputExeName) / sizeof(InputExeName[0])) - 1) { @@ -3526,7 +3526,7 @@ SetConsoleInputExeNameA(LPCSTR lpInputExeName) SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + Status = RtlAnsiStringToUnicodeString(&InputExeNameU, &InputExeNameA, TRUE); if(NT_SUCCESS(Status)) { @@ -3577,7 +3577,7 @@ GetConsoleInputExeNameW(DWORD nBufferLength, LPWSTR lpBuffer) SetLastErrorByStatus(_SEH_GetExceptionCode()); } _SEH_END; - + RtlLeaveCriticalSection(&ConsoleLock); return lenName; @@ -3594,7 +3594,7 @@ GetConsoleInputExeNameA(DWORD nBufferLength, LPSTR lpBuffer) { WCHAR *Buffer; DWORD Ret; - + if(nBufferLength > 0) { Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, nBufferLength * sizeof(WCHAR)); @@ -3608,7 +3608,7 @@ GetConsoleInputExeNameA(DWORD nBufferLength, LPSTR lpBuffer) { Buffer = NULL; } - + Ret = GetConsoleInputExeNameW(nBufferLength, Buffer); if(nBufferLength > 0) { @@ -3616,19 +3616,19 @@ GetConsoleInputExeNameA(DWORD nBufferLength, LPSTR lpBuffer) { UNICODE_STRING BufferU; ANSI_STRING BufferA; - + RtlInitUnicodeString(&BufferU, Buffer); BufferA.Length = 0; BufferA.MaximumLength = nBufferLength; BufferA.Buffer = lpBuffer; - + RtlUnicodeStringToAnsiString(&BufferA, &BufferU, FALSE); } - + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); } - + return Ret; } diff --git a/reactos/lib/kernel32/misc/dllmain.c b/reactos/lib/kernel32/misc/dllmain.c index c30baff4e29..26805620b71 100644 --- a/reactos/lib/kernel32/misc/dllmain.c +++ b/reactos/lib/kernel32/misc/dllmain.c @@ -3,7 +3,7 @@ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/kernel32/misc/dllmain.c - * PURPOSE: Initialization + * PURPOSE: Initialization * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) * UPDATE HISTORY: * Created 01/11/98 @@ -82,7 +82,7 @@ DllMain(HANDLE hDll, LPVOID lpReserved) { NTSTATUS Status; - + (void)lpReserved; DPRINT("DllMain(hInst %lx, dwReason %lu)\n", @@ -149,7 +149,7 @@ DllMain(HANDLE hDll, /* Insert more dll attach stuff here! */ - + DllInitialized = TRUE; break; diff --git a/reactos/lib/kernel32/misc/errormsg.c b/reactos/lib/kernel32/misc/errormsg.c index 468bf183c33..dfa38efaa70 100644 --- a/reactos/lib/kernel32/misc/errormsg.c +++ b/reactos/lib/kernel32/misc/errormsg.c @@ -237,7 +237,7 @@ DWORD WINAPI FormatMessageA( SetLastError (ERROR_RESOURCE_LANG_NOT_FOUND); return 0; } - + from = RtlAllocateHeap(RtlGetProcessHeap(), 0, bufsize + 1 ); load_messageA(hmodule,dwMessageId,dwLanguageId,from,bufsize+1); } @@ -490,7 +490,7 @@ DWORD WINAPI FormatMessageW( SetLastError (ERROR_RESOURCE_LANG_NOT_FOUND); return 0; } - + from = RtlAllocateHeap(RtlGetProcessHeap(), 0, bufsize + 1 ); load_messageA(hmodule,dwMessageId,dwLanguageId,from,bufsize+1); } diff --git a/reactos/lib/kernel32/misc/handle.c b/reactos/lib/kernel32/misc/handle.c index bedfbc7d9fa..a20fe7a4dca 100644 --- a/reactos/lib/kernel32/misc/handle.c +++ b/reactos/lib/kernel32/misc/handle.c @@ -38,7 +38,7 @@ GetHandleInformation (HANDLE hObject, ULONG BytesWritten; NTSTATUS Status; DWORD Flags; - + Ppb = NtCurrentPeb()->ProcessParameters; switch ((ULONG)hObject) { @@ -123,7 +123,7 @@ SetHandleInformation (HANDLE hObject, SetLastErrorByStatus (Status); return FALSE; } - + return TRUE; } else @@ -148,7 +148,7 @@ BOOL STDCALL CloseHandle(HANDLE hObject) { PRTL_USER_PROCESS_PARAMETERS Ppb; NTSTATUS Status; - + Ppb = NtCurrentPeb()->ProcessParameters; switch ((ULONG)hObject) { @@ -162,19 +162,19 @@ BOOL STDCALL CloseHandle(HANDLE hObject) hObject = Ppb->hStdError; break; } - + if (IsConsoleHandle(hObject)) { return(CloseConsoleHandle(hObject)); } - + Status = NtClose(hObject); if (!NT_SUCCESS(Status)) - { + { SetLastErrorByStatus (Status); return FALSE; } - + return TRUE; } @@ -193,7 +193,7 @@ BOOL STDCALL DuplicateHandle(HANDLE hSourceProcessHandle, PRTL_USER_PROCESS_PARAMETERS Ppb; DWORD SourceProcessId, TargetProcessId; NTSTATUS Status; - + Ppb = NtCurrentPeb()->ProcessParameters; switch ((ULONG)hSourceHandle) { @@ -207,7 +207,7 @@ BOOL STDCALL DuplicateHandle(HANDLE hSourceProcessHandle, hSourceHandle = Ppb->hStdError; break; } - + if (IsConsoleHandle(hSourceHandle)) { SourceProcessId = GetProcessId(hSourceProcessHandle); @@ -223,7 +223,7 @@ BOOL STDCALL DuplicateHandle(HANDLE hSourceProcessHandle, *lpTargetHandle = DuplicateConsoleHandle(hSourceHandle, dwDesiredAccess, bInheritHandle, dwOptions); return *lpTargetHandle != INVALID_HANDLE_VALUE; } - + Status = NtDuplicateObject(hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, @@ -236,7 +236,7 @@ BOOL STDCALL DuplicateHandle(HANDLE hSourceProcessHandle, SetLastErrorByStatus (Status); return FALSE; } - + return TRUE; } diff --git a/reactos/lib/kernel32/misc/lang.c b/reactos/lib/kernel32/misc/lang.c index f7160ee3a87..e4fb9d71639 100644 --- a/reactos/lib/kernel32/misc/lang.c +++ b/reactos/lib/kernel32/misc/lang.c @@ -12,7 +12,7 @@ #define NDEBUG #include "../include/debug.h" -/* FIXME: these are included in winnls.h, however including this file causes alot of +/* FIXME: these are included in winnls.h, however including this file causes alot of conflicting type errors. */ #define LOCALE_SYEARMONTH 0x1006 @@ -215,24 +215,24 @@ EnumSystemGeoID( SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + switch(GeoClass) { case GEOCLASS_NATION: /*RtlEnterCriticalSection(&DllLock); - + FIXME - Get GEO IDs calling Csr - + RtlLeaveCriticalSection(&DllLock);*/ - + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); break; - + default: SetLastError(ERROR_INVALID_FLAGS); return FALSE; } - + return FALSE; } @@ -366,7 +366,7 @@ EnumSystemLocalesW ( // Call Enum func if (!lpLocaleEnumProc((LPWSTR)lpLocale)) break; - + // Zero previous values RtlZeroMemory(pFullInfo, length); @@ -637,7 +637,7 @@ INT RosGetRegistryLocaleInfo( LPCWSTR lpValue, LPWSTR lpBuffer, INT nLen ) if (!ntStatus) { nRet = (dwSize - nInfoSize) / sizeof(WCHAR); - + if (!nRet || ((WCHAR *)kvpiInfo->Data)[nRet - 1]) { if (nRet < nLen || !lpBuffer) nRet++; @@ -741,7 +741,7 @@ GetLocaleInfoW ( UINT uiNum; WCHAR *chEnd, *chTmp = HeapAlloc( GetProcessHeap(), 0, (*ch + 1) * sizeof(WCHAR) ); - if (!chTmp) + if (!chTmp) return 0; memcpy( chTmp, ch + 1, *ch * sizeof(WCHAR) ); @@ -1333,7 +1333,7 @@ SetLocaleInfoW ( * RIPPED FROM WINE's dlls\kernel\locale.c rev 1.42 * * SetThreadLocale (KERNEL32.@) - * + * * Set the current threads locale. * * PARAMS @@ -1363,7 +1363,7 @@ BOOL WINAPI SetThreadLocale( LCID lcid ) * Wine save the acp for easy/fast access, but ROS has no such Teb member. * Maybe add this member to ros as well? */ - + /* Lag test app for å se om locale etc, endres i en app. etter at prosessen er startet, eller om bare nye prosesser blir berørt. diff --git a/reactos/lib/kernel32/misc/lcformat.c b/reactos/lib/kernel32/misc/lcformat.c index c07b95890d4..67cc535b0e2 100644 --- a/reactos/lib/kernel32/misc/lcformat.c +++ b/reactos/lib/kernel32/misc/lcformat.c @@ -22,12 +22,12 @@ */ /* - * Whole file ripped from Wine's dlls\kernel\lcformat.c, rev 1.7 and is + * Whole file ripped from Wine's dlls\kernel\lcformat.c, rev 1.7 and is * unchanged except that includes are different. I thought about adding * @implemeted to each exported function, but this might make merging harder? * -Gunnar */ - + #define WINVER 0x0500 #include diff --git a/reactos/lib/kernel32/misc/ldr.c b/reactos/lib/kernel32/misc/ldr.c index 1c6f9730ef4..1ca6ce8763f 100644 --- a/reactos/lib/kernel32/misc/ldr.c +++ b/reactos/lib/kernel32/misc/ldr.c @@ -53,7 +53,7 @@ GetDllLoadPath(LPCWSTR lpModule) while (lpModuleEnd > lpModule && *lpModuleEnd != L'/' && *lpModuleEnd != L'\\' && *lpModuleEnd != L':') --lpModuleEnd; - Length = (lpModuleEnd - lpModule) + 1; + Length = (lpModuleEnd - lpModule) + 1; } Length += GetCurrentDirectoryW(0, NULL); @@ -131,7 +131,7 @@ LoadLibraryExA ( ) { PWCHAR FileNameW; - + if (!(FileNameW = FilenameA2W(lpLibFileName, FALSE))) return FALSE; @@ -173,7 +173,7 @@ LoadLibraryExW ( if ( lpLibFileName == NULL ) return NULL; - dwFlags &= + dwFlags &= DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE | LOAD_WITH_ALTERED_SEARCH_PATH; @@ -189,7 +189,7 @@ LoadLibraryExW ( SetLastErrorByStatus (Status); return NULL; } - + return hInst; } @@ -474,7 +474,7 @@ LoadModule ( char FileName[MAX_PATH]; char *CommandLine, *t; BYTE Length; - + LoadParams = (LOADPARMS32*)lpParameterBlock; if(!lpModuleName || !LoadParams || (((WORD*)LoadParams->lpCmdShow)[0] != 2)) { @@ -482,13 +482,13 @@ LoadModule ( SetLastError(ERROR_INVALID_PARAMETER); return 0; } - + if(!SearchPathA(NULL, lpModuleName, ".exe", MAX_PATH, FileName, NULL) && !SearchPathA(NULL, lpModuleName, NULL, MAX_PATH, FileName, NULL)) { return ERROR_FILE_NOT_FOUND; } - + Length = (BYTE)LoadParams->lpCmdLine[0]; if(!(CommandLine = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(lpModuleName) + Length + 2))) @@ -496,24 +496,24 @@ LoadModule ( SetLastError(ERROR_NOT_ENOUGH_MEMORY); return 0; } - + /* Create command line string */ strcpy(CommandLine, lpModuleName); t = CommandLine + strlen(CommandLine); *(t++) = ' '; memcpy(t, LoadParams->lpCmdLine + 1, Length); - + /* Build StartupInfo */ RtlZeroMemory(&StartupInfo, sizeof(STARTUPINFOA)); StartupInfo.cb = sizeof(STARTUPINFOA); StartupInfo.dwFlags = STARTF_USESHOWWINDOW; StartupInfo.wShowWindow = ((WORD*)LoadParams->lpCmdShow)[1]; - + if(!CreateProcessA(FileName, CommandLine, NULL, NULL, FALSE, 0, LoadParams->lpEnvAddress, NULL, &StartupInfo, &ProcessInformation)) { DWORD Error; - + HeapFree(GetProcessHeap(), 0, CommandLine); /* return the right value */ Error = GetLastError(); @@ -531,15 +531,15 @@ LoadModule ( } return 0; } - + HeapFree(GetProcessHeap(), 0, CommandLine); - + /* Wait up to 15 seconds for the process to become idle */ WaitForInputIdle(ProcessInformation.hProcess, 15000); - + CloseHandle(ProcessInformation.hThread); CloseHandle(ProcessInformation.hProcess); - + return 33; } diff --git a/reactos/lib/kernel32/misc/lzexpand_main.c b/reactos/lib/kernel32/misc/lzexpand_main.c index a9dfa7fffdc..73d7da38a39 100644 --- a/reactos/lib/kernel32/misc/lzexpand_main.c +++ b/reactos/lib/kernel32/misc/lzexpand_main.c @@ -500,7 +500,7 @@ LONG WINAPI LZCopy( HFILE src, HFILE dest ) srcfd = (!(lzs = GET_LZ_STATE(src))) ? src : lzs->realfd; GetFileTime((HANDLE)srcfd, NULL, NULL, &filetime); SetFileTime((HANDLE)dest, NULL, NULL, &filetime); - + /* close handle */ if (usedlzinit) LZClose(src); diff --git a/reactos/lib/kernel32/misc/nls.c b/reactos/lib/kernel32/misc/nls.c index 51bda6d1af8..dcb39d83a78 100755 --- a/reactos/lib/kernel32/misc/nls.c +++ b/reactos/lib/kernel32/misc/nls.c @@ -97,7 +97,7 @@ NlsInit() { NtClose(Handle); } - + /* Setup ANSI code page. */ AnsiCodePage.CodePage = CP_ACP; AnsiCodePage.SectionHandle = NULL; @@ -195,10 +195,10 @@ IntGetCodePageEntry(UINT CodePage) WCHAR FileName[MAX_PATH + 1]; UINT FileNamePos; PCODEPAGE_ENTRY CodePageEntry; - + if (CodePage == CP_THREAD_ACP) { - if (!GetLocaleInfoW(GetThreadLocale(), LOCALE_IDEFAULTANSICODEPAGE | + if (!GetLocaleInfoW(GetThreadLocale(), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (WCHAR *)&CodePage, sizeof(CodePage) / sizeof(WCHAR))) { @@ -208,7 +208,7 @@ IntGetCodePageEntry(UINT CodePage) } else if (CodePage == CP_MACCP) { - if (!GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTMACCODEPAGE | + if (!GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTMACCODEPAGE | LOCALE_RETURN_NUMBER, (WCHAR *)&CodePage, sizeof(CodePage) / sizeof(WCHAR))) { @@ -292,7 +292,7 @@ IntGetCodePageEntry(UINT CodePage) CodePageEntry->SectionHandle = SectionHandle; CodePageEntry->SectionMapping = SectionMapping; RtlInitCodePageTable((PUSHORT)SectionMapping, &CodePageEntry->CodePageTable); - + /* Insert the new entry to list and unlock. Uff. */ InsertTailList(&CodePageListHead, &CodePageEntry->Entry); RtlLeaveCriticalSection(&CodePageListLock); @@ -315,7 +315,7 @@ IntMultiByteToWideCharUTF8(DWORD Flags, UCHAR Char, Length; WCHAR WideChar; ULONG Count; - + if (Flags != 0) { SetLastError(ERROR_INVALID_FLAGS); @@ -606,7 +606,7 @@ GetNlsSectionName(UINT CodePage, UINT Base, ULONG Unknown, return FALSE; /* - * If the name including the terminating NULL character doesn't + * If the name including the terminating NULL character doesn't * fit in the output buffer then fail. */ if (strlen(Integer) + strlen(BaseName) >= ResultSize) @@ -624,7 +624,7 @@ GetNlsSectionName(UINT CodePage, UINT Base, ULONG Unknown, * @param CodePage * Code page number to get file name of. * @param FileName - * Buffer that is filled with file name of successful return. Can + * Buffer that is filled with file name of successful return. Can * be set to NULL. * @param FileNameSize * Size of the buffer to hold file name in WCHARs. @@ -649,7 +649,7 @@ GetCPFileNameFromRegistry(UINT CodePage, LPWSTR FileName, ULONG FileNameSize) ValueName.MaximumLength = sizeof(ValueNameBuffer); if (!NT_SUCCESS(RtlIntegerToUnicodeString(CodePage, 10, &ValueName))) return FALSE; - + /* Open the registry key containing file name mappings. */ RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\System\\" L"CurrentControlSet\\Control\\Nls\\CodePage"); @@ -781,7 +781,7 @@ MultiByteToWideChar(UINT CodePage, DWORD Flags, /** * Convert a wide-charater string to closest multi-byte equivalent. - * + * * @param CodePage * Code page to be used to perform the conversion. It can be also * one of the special values (CP_ACP for ANSI code page, CP_MACCP @@ -791,23 +791,23 @@ MultiByteToWideChar(UINT CodePage, DWORD Flags, * Additional conversion flags (WC_NO_BEST_FIT_CHARS, WC_COMPOSITECHECK, * WC_DISCARDNS, WC_SEPCHARS, WC_DEFAULTCHAR). * @param WideCharString - * Points to the wide-character string to be converted. + * Points to the wide-character string to be converted. * @param WideCharCount * Size in WCHARs of WideCharStr, or 0 if the caller just wants to * know how large WideCharString should be for a successful conversion. * @param MultiByteString - * Points to the buffer to receive the translated string. + * Points to the buffer to receive the translated string. * @param MultiByteCount - * Specifies the size in bytes of the buffer pointed to by the - * MultiByteString parameter. If this value is zero, the function - * returns the number of bytes required for the buffer. - * @param DefaultChar - * Points to the character used if a wide character cannot be - * represented in the specified code page. If this parameter is - * NULL, a system default value is used. - * @param UsedDefaultChar + * Specifies the size in bytes of the buffer pointed to by the + * MultiByteString parameter. If this value is zero, the function + * returns the number of bytes required for the buffer. + * @param DefaultChar + * Points to the character used if a wide character cannot be + * represented in the specified code page. If this parameter is + * NULL, a system default value is used. + * @param UsedDefaultChar * Points to a flag that indicates whether a default character was - * used. This parameter can be NULL. + * used. This parameter can be NULL. * * @return Zero on error, otherwise the number of bytes written in the * MultiByteString buffer. Or the number of bytes needed for @@ -920,7 +920,7 @@ IsDBCSLeadByteEx ( ) { PCODEPAGE_ENTRY CodePageEntry; - + CodePageEntry = IntGetCodePageEntry(CodePage); if(CodePageEntry != NULL) { diff --git a/reactos/lib/kernel32/misc/profile.c b/reactos/lib/kernel32/misc/profile.c index d9acdda1b1c..bdb46250a75 100644 --- a/reactos/lib/kernel32/misc/profile.c +++ b/reactos/lib/kernel32/misc/profile.c @@ -505,7 +505,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) szNameEnd++; len = (int)(szNameEnd - szLineStart); - + if (len || !prev_key || *prev_key->name) { /* no need to allocate +1 for NULL terminating character as diff --git a/reactos/lib/kernel32/misc/stubs.c b/reactos/lib/kernel32/misc/stubs.c index 573a16fa4d5..bbe414e1a29 100644 --- a/reactos/lib/kernel32/misc/stubs.c +++ b/reactos/lib/kernel32/misc/stubs.c @@ -670,7 +670,7 @@ GetWriteWatch( BOOL STDCALL HeapQueryInformation ( - HANDLE HeapHandle, + HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation OPTIONAL, SIZE_T HeapInformationLength OPTIONAL, @@ -687,7 +687,7 @@ HeapQueryInformation ( BOOL STDCALL HeapSetInformation ( - HANDLE HeapHandle, + HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation OPTIONAL, SIZE_T HeapInformationLength OPTIONAL diff --git a/reactos/lib/kernel32/misc/sysinfo.c b/reactos/lib/kernel32/misc/sysinfo.c index 52bbca4a775..66c290e0da0 100644 --- a/reactos/lib/kernel32/misc/sysinfo.c +++ b/reactos/lib/kernel32/misc/sysinfo.c @@ -90,11 +90,11 @@ GetSystemInfo ( Si->dwProcessorType = PROCESSOR_INTEL_PENTIUM; } break; - + case PROCESSOR_ARCHITECTURE_MIPS: Si->dwProcessorType = PROCESSOR_MIPS_R4000; break; - + case PROCESSOR_ARCHITECTURE_ALPHA: Si->dwProcessorType = PROCESSOR_ALPHA_21064; break; @@ -130,7 +130,7 @@ GetSystemInfo ( Si->dwProcessorType = -1; } break; - + } /* Once hardcoded to 64kb */ Si->dwAllocationGranularity = Sbi.AllocationGranularity; diff --git a/reactos/lib/kernel32/misc/time.c b/reactos/lib/kernel32/misc/time.c index c0aea8aa67a..d389f55ffbf 100644 --- a/reactos/lib/kernel32/misc/time.c +++ b/reactos/lib/kernel32/misc/time.c @@ -74,7 +74,7 @@ FileTimeToDosDateTime( pddate->Month = SystemTime.wMonth; pddate->Year = SystemTime.wYear - 1980; - return TRUE; + return TRUE; } @@ -153,7 +153,7 @@ GetSystemTimeAsFileTime (PFILETIME lpFileTime) /* * @implemented */ -BOOL +BOOL STDCALL SystemTimeToFileTime( CONST SYSTEMTIME * lpSystemTime, @@ -444,7 +444,7 @@ GetSystemTimeAdjustment(PDWORD lpTimeAdjustment, { SYSTEM_QUERY_TIME_ADJUSTMENT Buffer; NTSTATUS Status; - + Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation, &Buffer, sizeof(SYSTEM_QUERY_TIME_ADJUSTMENT), @@ -454,11 +454,11 @@ GetSystemTimeAdjustment(PDWORD lpTimeAdjustment, SetLastErrorByStatus(Status); return FALSE; } - + *lpTimeAdjustment = (DWORD)Buffer.TimeAdjustment; *lpTimeIncrement = (DWORD)Buffer.MaximumIncrement; *lpTimeAdjustmentDisabled = (BOOL)Buffer.TimeSynchronization; - + return TRUE; } @@ -472,10 +472,10 @@ SetSystemTimeAdjustment(DWORD dwTimeAdjustment, { NTSTATUS Status; SYSTEM_SET_TIME_ADJUSTMENT Buffer; - + Buffer.TimeAdjustment = (ULONG)dwTimeAdjustment; Buffer.TimeSynchronization = (BOOLEAN)bTimeAdjustmentDisabled; - + Status = NtSetSystemInformation(SystemTimeAdjustmentInformation, &Buffer, sizeof(SYSTEM_SET_TIME_ADJUSTMENT)); @@ -484,7 +484,7 @@ SetSystemTimeAdjustment(DWORD dwTimeAdjustment, SetLastErrorByStatus(Status); return FALSE; } - + return TRUE; } @@ -502,17 +502,17 @@ GetSystemTimes( { SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcPerfInfo; NTSTATUS Status; - + Status = ZwQuerySystemInformation(SystemProcessorPerformanceInformation, &SysProcPerfInfo, sizeof(SysProcPerfInfo), NULL); - + if (!NT_SUCCESS(Status)) { SetLastErrorByStatus(Status); return FALSE; - } + } /* Good only for one processor system. */ @@ -525,7 +525,7 @@ GetSystemTimes( lpUserTime->dwLowDateTime = SysProcPerfInfo.UserTime.LowPart; lpUserTime->dwHighDateTime = SysProcPerfInfo.UserTime.HighPart; - + return TRUE; } diff --git a/reactos/lib/kernel32/misc/timerqueue.c b/reactos/lib/kernel32/misc/timerqueue.c index 7261892811f..abcc0df099f 100644 --- a/reactos/lib/kernel32/misc/timerqueue.c +++ b/reactos/lib/kernel32/misc/timerqueue.c @@ -39,8 +39,8 @@ HANDLE DefaultTimerQueue = NULL; /* * Create the default timer queue for the current process. This function is only - * called if CreateTimerQueueTimer() or SetTimerQueueTimer() is called. - * However, ChangeTimerQueueTimer() fails with ERROR_INVALID_PARAMETER if the + * called if CreateTimerQueueTimer() or SetTimerQueueTimer() is called. + * However, ChangeTimerQueueTimer() fails with ERROR_INVALID_PARAMETER if the * default timer queue has not been created, because it assumes there has to be * a timer queue with a timer if it want's to be changed. */ @@ -48,9 +48,9 @@ static BOOL IntCreateDefaultTimerQueue(VOID) { NTSTATUS Status; - + /* FIXME - make this thread safe */ - + /* create the timer queue */ Status = RtlCreateTimerQueue(&DefaultTimerQueue); if(!NT_SUCCESS(Status)) @@ -59,7 +59,7 @@ IntCreateDefaultTimerQueue(VOID) DPRINT1("Unable to create the default timer queue!\n"); return FALSE; } - + return TRUE; } @@ -75,7 +75,7 @@ CancelTimerQueueTimer(HANDLE TimerQueue, but delete the timer, we just do the same as DeleteTimerQueueTimer(), without passing a completion event. */ NTSTATUS Status; - + if(TimerQueue == NULL) { /* let's use the process' default timer queue. We assume the default timer @@ -87,22 +87,22 @@ CancelTimerQueueTimer(HANDLE TimerQueue, return FALSE; } } - + if(Timer == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + /* delete the timer */ Status = RtlDeleteTimer(TimerQueue, Timer, NULL); - + if(!NT_SUCCESS(Status)) { SetLastErrorByStatus(Status); - return FALSE; + return FALSE; } - + return TRUE; } @@ -117,7 +117,7 @@ ChangeTimerQueueTimer(HANDLE TimerQueue, ULONG Period) { NTSTATUS Status; - + if(TimerQueue == NULL) { /* let's use the process' default timer queue. We assume the default timer @@ -129,13 +129,13 @@ ChangeTimerQueueTimer(HANDLE TimerQueue, return FALSE; } } - + if(Timer == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + /* update the timer */ Status = RtlUpdateTimer(TimerQueue, Timer, DueTime, Period); if(!NT_SUCCESS(Status)) @@ -143,7 +143,7 @@ ChangeTimerQueueTimer(HANDLE TimerQueue, SetLastErrorByStatus(Status); return FALSE; } - + return TRUE; } @@ -156,7 +156,7 @@ CreateTimerQueue(VOID) { HANDLE Handle; NTSTATUS Status; - + /* create the timer queue */ Status = RtlCreateTimerQueue(&Handle); if(!NT_SUCCESS(Status)) @@ -164,7 +164,7 @@ CreateTimerQueue(VOID) SetLastErrorByStatus(Status); return NULL; } - + return Handle; } @@ -182,11 +182,11 @@ CreateTimerQueueTimer(PHANDLE phNewTimer, ULONG Flags) { NTSTATUS Status; - + /* windows seems not to test this parameter at all, so we'll try to clear it here so we don't crash somewhere inside ntdll */ *phNewTimer = NULL; - + if(TimerQueue == NULL) { /* the default timer queue is requested, try to create it if it hasn't been already */ @@ -200,10 +200,10 @@ CreateTimerQueueTimer(PHANDLE phNewTimer, TimerQueue = DefaultTimerQueue; } } - + /* !!! Win doesn't even check if Callback == NULL, so we don't, too! That'll raise a nice exception later... */ - + /* create the timer */ Status = RtlCreateTimer(TimerQueue, phNewTimer, Callback, Parameter, DueTime, Period, Flags); @@ -212,7 +212,7 @@ CreateTimerQueueTimer(PHANDLE phNewTimer, SetLastErrorByStatus(Status); return FALSE; } - + return TRUE; } @@ -224,14 +224,14 @@ STDCALL DeleteTimerQueue(HANDLE TimerQueue) { NTSTATUS Status; - + /* We don't allow the user to delete the default timer queue */ if(TimerQueue == NULL) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } - + /* delete the timer queue */ Status = RtlDeleteTimerQueue(TimerQueue); return NT_SUCCESS(Status); @@ -246,31 +246,31 @@ DeleteTimerQueueEx(HANDLE TimerQueue, HANDLE CompletionEvent) { NTSTATUS Status; - + /* We don't allow the user to delete the default timer queue */ if(TimerQueue == NULL) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } - + /* delete the queue */ Status = RtlDeleteTimerQueueEx(TimerQueue, CompletionEvent); - + if((CompletionEvent != INVALID_HANDLE_VALUE && Status == STATUS_PENDING) || !NT_SUCCESS(Status)) { /* In case CompletionEvent == NULL, RtlDeleteTimerQueueEx() returns before all callback routines returned. We set the last error code to STATUS_PENDING - and return FALSE. In case CompletionEvent == INVALID_HANDLE_VALUE we only + and return FALSE. In case CompletionEvent == INVALID_HANDLE_VALUE we only can get here if another error occured. In case CompletionEvent is something else, we get here and fail, even though it isn't really an error (if Status == STATUS_PENDING). We also handle all other failures the same way. */ - + SetLastErrorByStatus(Status); - return FALSE; + return FALSE; } - + return TRUE; } @@ -284,7 +284,7 @@ DeleteTimerQueueTimer(HANDLE TimerQueue, HANDLE CompletionEvent) { NTSTATUS Status; - + if(TimerQueue == NULL) { /* let's use the process' default timer queue. We assume the default timer @@ -296,30 +296,30 @@ DeleteTimerQueueTimer(HANDLE TimerQueue, return FALSE; } } - + if(Timer == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + /* delete the timer */ Status = RtlDeleteTimer(TimerQueue, Timer, CompletionEvent); - + if((CompletionEvent != INVALID_HANDLE_VALUE && Status == STATUS_PENDING) || !NT_SUCCESS(Status)) { /* In case CompletionEvent == NULL, RtlDeleteTimer() returns before the callback routine returned. We set the last error code to STATUS_PENDING - and return FALSE. In case CompletionEvent == INVALID_HANDLE_VALUE we only + and return FALSE. In case CompletionEvent == INVALID_HANDLE_VALUE we only can get here if another error occured. In case CompletionEvent is something else, we get here and fail, even though it isn't really an error (if Status == STATUS_PENDING). We also handle all other failures the same way. */ - + SetLastErrorByStatus(Status); - return FALSE; + return FALSE; } - + return TRUE; } @@ -342,12 +342,12 @@ SetTimerQueueTimer(HANDLE TimerQueue, CreateTimerQueueTimer() there's only one flag (WT_EXECUTEINIOTHREAD) that causes the callback function queued to an I/O worker thread. I guess it uses this flag if PreferIo == TRUE, otherwise let's just use WT_EXECUTEDEFAULT. We should - test this though, this is only guess work and I'm too lazy to do further + test this though, this is only guess work and I'm too lazy to do further investigation. */ - + HANDLE Timer; NTSTATUS Status; - + if(TimerQueue == NULL) { /* the default timer queue is requested, try to create it if it hasn't been already */ @@ -361,7 +361,7 @@ SetTimerQueueTimer(HANDLE TimerQueue, TimerQueue = DefaultTimerQueue; } } - + /* create the timer */ Status = RtlCreateTimer(TimerQueue, &Timer, Callback, Parameter, DueTime, Period, (PreferIo ? WT_EXECUTEINIOTHREAD : WT_EXECUTEDEFAULT)); @@ -370,7 +370,7 @@ SetTimerQueueTimer(HANDLE TimerQueue, SetLastErrorByStatus(Status); return NULL; } - + return Timer; } diff --git a/reactos/lib/kernel32/misc/toolhelp.c b/reactos/lib/kernel32/misc/toolhelp.c index e818a53a7bf..163e1ef44ca 100644 --- a/reactos/lib/kernel32/misc/toolhelp.c +++ b/reactos/lib/kernel32/misc/toolhelp.c @@ -267,7 +267,7 @@ TH32CreateSnapshotSectionInitialize(DWORD dwFlags, if(dwFlags & (TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD)) { ULONG ProcOffset = 0; - + ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)ProcThrdInfo; do { @@ -373,14 +373,14 @@ TH32CreateSnapshotSectionInitialize(DWORD dwFlags, ModuleListEntry->modBaseAddr = (BYTE*)mi->ModuleEntry[i].Base; ModuleListEntry->modBaseSize = mi->ModuleEntry[i].Size; ModuleListEntry->hModule = (HMODULE)mi->ModuleEntry[i].Base; - + MultiByteToWideChar(CP_ACP, 0, &mi->ModuleEntry[i].ImageName[mi->ModuleEntry[i].ModuleNameOffset], -1, ModuleListEntry->szModule, sizeof(ModuleListEntry->szModule) / sizeof(ModuleListEntry->szModule[0])); - + MultiByteToWideChar(CP_ACP, 0, mi->ModuleEntry[i].ImageName, @@ -398,7 +398,7 @@ TH32CreateSnapshotSectionInitialize(DWORD dwFlags, if(dwFlags & TH32CS_SNAPPROCESS) { ULONG ProcOffset = 0; - + Snapshot->ProcessListCount = nProcesses; Snapshot->ProcessListOffset = DataOffset; ProcessListEntry = (LPPROCESSENTRY32W)OffsetToPtr(Snapshot, DataOffset); @@ -406,7 +406,7 @@ TH32CreateSnapshotSectionInitialize(DWORD dwFlags, do { ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)ProcessInfo + ProcOffset); - + ProcessListEntry->dwSize = sizeof(PROCESSENTRY32W); ProcessListEntry->cntUsage = 0; /* no longer used */ ProcessListEntry->th32ProcessID = (ULONG)ProcessInfo->UniqueProcessId; @@ -426,7 +426,7 @@ TH32CreateSnapshotSectionInitialize(DWORD dwFlags, { lstrcpyW(ProcessListEntry->szExeFile, L"[System Process]"); } - + ProcessListEntry++; ProcOffset = ProcessInfo->NextEntryOffset; @@ -439,7 +439,7 @@ TH32CreateSnapshotSectionInitialize(DWORD dwFlags, if(dwFlags & TH32CS_SNAPTHREAD) { ULONG ProcOffset = 0; - + Snapshot->ThreadListCount = nThreads; Snapshot->ThreadListOffset = DataOffset; ThreadListEntry = (LPTHREADENTRY32)OffsetToPtr(Snapshot, DataOffset); @@ -448,7 +448,7 @@ TH32CreateSnapshotSectionInitialize(DWORD dwFlags, { PSYSTEM_THREAD_INFORMATION ThreadInfo; ULONG n; - + ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)ProcessInfo + ProcOffset); ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(ProcessInfo + 1); diff --git a/reactos/lib/kernel32/misc/version.c b/reactos/lib/kernel32/misc/version.c index 94952f65e93..43473bcf97d 100644 --- a/reactos/lib/kernel32/misc/version.c +++ b/reactos/lib/kernel32/misc/version.c @@ -34,7 +34,7 @@ GetVersion(VOID) /* build number */ if(pPeb->OSPlatformId != VER_PLATFORM_WIN32_WINDOWS) nVersion |= ((DWORD)(pPeb->OSBuildNumber)) << 16; - + /* non-NT platform flag */ if(pPeb->OSPlatformId != VER_PLATFORM_WIN32_NT) nVersion |= 0x80000000; @@ -53,7 +53,7 @@ GetVersionExW( ) { NTSTATUS Status; - + if(lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOW) && lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXW)) { @@ -68,7 +68,7 @@ GetVersionExW( if(NT_SUCCESS(Status)) { int ln, maxlen; - + /* append a reactos specific string to the szCSDVersion string */ /* FIXME - we shouldn't do this when there is a (ros-specific) compatibility @@ -85,7 +85,7 @@ GetVersionExW( L"ReactOS " KERNEL_VERSION_STR L" (Build " KERNEL_VERSION_BUILD_STR L")", maxlen - ln); } - + return TRUE; } @@ -103,9 +103,9 @@ GetVersionExA( ) { OSVERSIONINFOEXW viw; - + RtlZeroMemory(&viw, sizeof(viw)); - + switch(lpVersionInformation->dwOSVersionInfoSize) { case sizeof(OSVERSIONINFOA): @@ -123,25 +123,25 @@ GetVersionExA( SetLastError(ERROR_INSUFFICIENT_BUFFER); return FALSE; } - + if(GetVersionExW((LPOSVERSIONINFOW)&viw)) { ANSI_STRING CSDVersionA; UNICODE_STRING CSDVersionW; - + /* copy back fields that match both supported structures */ lpVersionInformation->dwMajorVersion = viw.dwMajorVersion; lpVersionInformation->dwMinorVersion = viw.dwMinorVersion; lpVersionInformation->dwBuildNumber = viw.dwBuildNumber; lpVersionInformation->dwPlatformId = viw.dwPlatformId; - + /* convert the win version string */ RtlInitUnicodeString(&CSDVersionW, viw.szCSDVersion); - + CSDVersionA.Length = 0; CSDVersionA.MaximumLength = sizeof(lpVersionInformation->szCSDVersion); CSDVersionA.Buffer = lpVersionInformation->szCSDVersion; - + RtlUnicodeStringToAnsiString(&CSDVersionA, &CSDVersionW, FALSE); /* convert the ReactOS version string */ @@ -153,7 +153,7 @@ GetVersionExA( CSDVersionA.Length = 0; RtlUnicodeStringToAnsiString(&CSDVersionA, &CSDVersionW, FALSE); - + /* copy back the extended fields */ if(viw.dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW)) { @@ -163,10 +163,10 @@ GetVersionExA( ((LPOSVERSIONINFOEXA)lpVersionInformation)->wProductType = viw.wProductType; ((LPOSVERSIONINFOEXA)lpVersionInformation)->wReserved = viw.wReserved; } - + return TRUE; } - + return FALSE; } @@ -183,7 +183,7 @@ VerifyVersionInfoW( ) { NTSTATUS Status; - + Status = RtlVerifyVersionInfo((PRTL_OSVERSIONINFOEXW)lpVersionInformation, dwTypeMask, dwlConditionMask); @@ -217,7 +217,7 @@ VerifyVersionInfoA( ) { OSVERSIONINFOEXW viex; - + viex.dwOSVersionInfoSize = sizeof(viex); viex.dwMajorVersion = lpVersionInformation->dwMajorVersion; viex.dwMinorVersion = lpVersionInformation->dwMinorVersion; @@ -229,7 +229,7 @@ VerifyVersionInfoA( viex.wSuiteMask = lpVersionInformation->wSuiteMask; viex.wProductType = lpVersionInformation->wProductType; viex.wReserved = lpVersionInformation->wReserved; - + return VerifyVersionInfoW(&viex, dwTypeMask, dwlConditionMask); } diff --git a/reactos/lib/kernel32/process/cmdline.c b/reactos/lib/kernel32/process/cmdline.c index 7cbae2945d5..b94226c4cce 100644 --- a/reactos/lib/kernel32/process/cmdline.c +++ b/reactos/lib/kernel32/process/cmdline.c @@ -40,11 +40,11 @@ InitCommandLines (VOID) CommandLineStringW.Length = Params->CommandLine.Length; CommandLineStringW.MaximumLength = CommandLineStringW.Length + sizeof(WCHAR); CommandLineStringW.Buffer = RtlAllocateHeap(GetProcessHeap(), - HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY, + HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY, CommandLineStringW.MaximumLength); RtlInitAnsiString(&CommandLineStringA, NULL); - + // copy command line RtlCopyUnicodeString (&CommandLineStringW, &(Params->CommandLine)); @@ -53,7 +53,7 @@ InitCommandLines (VOID) /* convert unicode string to ansi (or oem) */ if (bIsFileApiAnsi) RtlUnicodeStringToAnsiString (&CommandLineStringA, - &CommandLineStringW, + &CommandLineStringW, TRUE); else RtlUnicodeStringToOemString (&CommandLineStringA, diff --git a/reactos/lib/kernel32/process/create.c b/reactos/lib/kernel32/process/create.c index 29121b4b4b3..42b0f939956 100644 --- a/reactos/lib/kernel32/process/create.c +++ b/reactos/lib/kernel32/process/create.c @@ -19,7 +19,7 @@ /* FUNCTIONS ****************************************************************/ -extern __declspec(noreturn) +extern __declspec(noreturn) VOID CALLBACK ConsoleControlDispatcher(DWORD CodeAndFlag); __declspec(dllimport) @@ -55,12 +55,12 @@ VOID STDCALL RtlRosR32AttribsToNativeAttribs(OUT OBJECT_ATTRIBUTES * NativeAttri NativeAttribs->RootDirectory = NULL; NativeAttribs->Attributes = 0; NativeAttribs->SecurityQualityOfService = NULL; - + if(Ros32Attribs != NULL && Ros32Attribs->nLength >= sizeof(*Ros32Attribs)) { NativeAttribs->SecurityDescriptor = Ros32Attribs->lpSecurityDescriptor; - + if(Ros32Attribs->bInheritHandle) { NativeAttribs->Attributes |= OBJ_INHERIT; @@ -110,7 +110,7 @@ BOOL STDCALL CreateProcessA(LPCSTR lpApplicationName, * FUNCTION: The CreateProcess function creates a new process and its * primary thread. The new process executes the specified executable file * ARGUMENTS: - * + * * lpApplicationName = Pointer to name of executable module * lpCommandLine = Pointer to command line string * lpProcessAttributes = Process security attributes @@ -187,7 +187,7 @@ BOOL STDCALL CreateProcessA(LPCSTR lpApplicationName, while (*pcScan); nEnvLen = (ULONG_PTR)pcScan - (ULONG_PTR)lpEnvironment + 1; - + /* environment too large */ if(nEnvLen > ~((USHORT)0)) { @@ -207,7 +207,7 @@ BOOL STDCALL CreateProcessA(LPCSTR lpApplicationName, return FALSE; } } - + /* convert the strings */ RtlInitAnsiString(&strCommandLine, lpCommandLine); @@ -371,7 +371,7 @@ HANDLE STDCALL KlCreateFirstThread(HANDLE ProcessHandle, " StackReserve %lu,\n" " StackCommit %lu,\n" " StartAddress %p,\n" - " ThreadHandle %p,\n" + " ThreadHandle %p,\n" " ClientId %p,\n" " ParameterCount %u,\n" " Parameters[0] %p,\n" @@ -379,7 +379,7 @@ HANDLE STDCALL KlCreateFirstThread(HANDLE ProcessHandle, ")\n", ProcessHandle, &oaThreadAttribs, - dwCreationFlags & CREATE_SUSPENDED, + dwCreationFlags & CREATE_SUSPENDED, 0, Sii->StackReserve, Sii->StackCommit, @@ -409,7 +409,7 @@ HANDLE STDCALL KlCreateFirstThread(HANDLE ProcessHandle, SetLastErrorByStatus(nErrCode); return NULL; } - + DPRINT("StackReserve %p\n" "StackCommit %p\n" "ThreadHandle %p\n" @@ -733,7 +733,7 @@ GetFileName(LPCWSTR CurDir, LPCWSTR AppName, LPWSTR CmdLine, LPWSTR Buffer, /* * @implemented */ -BOOL STDCALL +BOOL STDCALL CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, @@ -773,7 +773,7 @@ CreateProcessW(LPCWSTR lpApplicationName, OBJECT_ATTRIBUTES ProcObjectAttributes; ULONG ProcAttributes = 0; PVOID ProcSecurity = NULL; - + DPRINT("CreateProcessW(lpApplicationName '%S', lpCommandLine '%S')\n", lpApplicationName, lpCommandLine); @@ -869,7 +869,7 @@ CreateProcessW(LPCWSTR lpApplicationName, return FALSE; } } - + /* * Process the application name and command line */ @@ -896,7 +896,7 @@ CreateProcessW(LPCWSTR lpApplicationName, /* * Create a section for the executable */ - + hSection = KlMapFile (ImagePathName); if (hSection == NULL) { @@ -916,7 +916,7 @@ CreateProcessW(LPCWSTR lpApplicationName, // Find the application name if (!RtlDosPathNameToNtPathName_U((LPWSTR)lpApplicationName, - &ApplicationNameString, NULL, NULL)) + &ApplicationNameString, NULL, NULL)) { return FALSE; } @@ -938,7 +938,7 @@ CreateProcessW(LPCWSTR lpApplicationName, RtlFreeUnicodeString(&ApplicationNameString); - if (!NT_SUCCESS(Status)) + if (!NT_SUCCESS(Status)) { DPRINT("Failed to open file\n"); SetLastErrorByStatus(Status); @@ -957,13 +957,13 @@ CreateProcessW(LPCWSTR lpApplicationName, &Offset, 0); - if (!NT_SUCCESS(Status)) + if (!NT_SUCCESS(Status)) { DPRINT("Failed to read from file\n"); SetLastErrorByStatus(Status); return FALSE; } - if (Iosb.Information != sizeof(DosHeader)) + if (Iosb.Information != sizeof(DosHeader)) { DPRINT("Failed to read dos header from file\n"); SetLastErrorByStatus(STATUS_INVALID_IMAGE_FORMAT); @@ -971,7 +971,7 @@ CreateProcessW(LPCWSTR lpApplicationName, } // Check the DOS signature - if (DosHeader.e_magic != IMAGE_DOS_SIGNATURE) + if (DosHeader.e_magic != IMAGE_DOS_SIGNATURE) { DPRINT("Failed dos magic check\n"); SetLastErrorByStatus(STATUS_INVALID_IMAGE_FORMAT); @@ -1048,7 +1048,7 @@ CreateProcessW(LPCWSTR lpApplicationName, * initialize the process priority class structure */ PriorityClass.Foreground = FALSE; - + if(dwCreationFlags & IDLE_PRIORITY_CLASS) { PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_IDLE; @@ -1093,13 +1093,13 @@ CreateProcessW(LPCWSTR lpApplicationName, NULL, NULL); /* FIXME - handle failure!!!!! */ - + Status = NtSetInformationProcess(hProcess, ProcessPriorityClass, &PriorityClass, sizeof(PROCESS_PRIORITY_CLASS)); /* FIXME - handle failure!!!!! */ - + if (lpStartupInfo) { if (lpStartupInfo->lpReserved2) @@ -1148,7 +1148,7 @@ CreateProcessW(LPCWSTR lpApplicationName, DUPLICATE_SAME_ACCESS); /* FIXME - handle failure!!!!! */ } - + /* * Close the section */ @@ -1170,7 +1170,7 @@ CreateProcessW(LPCWSTR lpApplicationName, * Tell the csrss server we are creating a new process */ CsrRequest.Type = CSRSS_CREATE_PROCESS; - CsrRequest.Data.CreateProcessRequest.NewProcessId = + CsrRequest.Data.CreateProcessRequest.NewProcessId = ProcessBasicInfo.UniqueProcessId; if (Sii.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) { @@ -1187,7 +1187,7 @@ CreateProcessW(LPCWSTR lpApplicationName, } CsrRequest.Data.CreateProcessRequest.Flags = dwCreationFlags; CsrRequest.Data.CreateProcessRequest.CtrlDispatcher = ConsoleControlDispatcher; - Status = CsrClientCallServer(&CsrRequest, + Status = CsrClientCallServer(&CsrRequest, &CsrReply, sizeof(CSRSS_API_REQUEST), sizeof(CSRSS_API_REPLY)); @@ -1279,7 +1279,7 @@ CreateProcessW(LPCWSTR lpApplicationName, else { DPRINT("Duplicate input handle\n"); - Status = NtDuplicateObject (NtCurrentProcess(), + Status = NtDuplicateObject (NtCurrentProcess(), Ppb->hStdInput, hProcess, &Ppb->hStdInput, @@ -1302,7 +1302,7 @@ CreateProcessW(LPCWSTR lpApplicationName, else { DPRINT("Duplicate output handle\n"); - Status = NtDuplicateObject (NtCurrentProcess(), + Status = NtDuplicateObject (NtCurrentProcess(), Ppb->hStdOutput, hProcess, &Ppb->hStdOutput, @@ -1323,7 +1323,7 @@ CreateProcessW(LPCWSTR lpApplicationName, CsrRequest.Type = CSRSS_DUPLICATE_HANDLE; CsrRequest.Data.DuplicateHandleRequest.ProcessId = ProcessBasicInfo.UniqueProcessId; CsrRequest.Data.DuplicateHandleRequest.Handle = CsrReply.Data.CreateProcessReply.OutputHandle; - Status = CsrClientCallServer(&CsrRequest, + Status = CsrClientCallServer(&CsrRequest, &CsrReply, sizeof(CSRSS_API_REQUEST), sizeof(CSRSS_API_REPLY)); @@ -1339,7 +1339,7 @@ CreateProcessW(LPCWSTR lpApplicationName, else { DPRINT("Duplicate error handle\n"); - Status = NtDuplicateObject (NtCurrentProcess(), + Status = NtDuplicateObject (NtCurrentProcess(), Ppb->hStdError, hProcess, &Ppb->hStdError, @@ -1377,7 +1377,7 @@ CreateProcessW(LPCWSTR lpApplicationName, { Ppb->Flags = 0; } - + /* * Create Process Environment Block */ @@ -1386,7 +1386,7 @@ CreateProcessW(LPCWSTR lpApplicationName, KlInitPeb(hProcess, Ppb, &ImageBaseAddress, Sii.Subsystem); RtlDestroyProcessParameters (Ppb); - + /* * Create the thread for the kernel */ diff --git a/reactos/lib/kernel32/process/job.c b/reactos/lib/kernel32/process/job.c index fe594f00c4d..a054222e199 100644 --- a/reactos/lib/kernel32/process/job.c +++ b/reactos/lib/kernel32/process/job.c @@ -30,11 +30,11 @@ CreateJobObjectA(LPSECURITY_ATTRIBUTES lpJobAttributes, HANDLE hJob; ANSI_STRING AnsiName; UNICODE_STRING UnicodeName; - + if(lpName != NULL) { NTSTATUS Status; - + RtlInitAnsiString(&AnsiName, lpName); Status = RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE); if(!NT_SUCCESS(Status)) @@ -43,7 +43,7 @@ CreateJobObjectA(LPSECURITY_ATTRIBUTES lpJobAttributes, return FALSE; } } - + hJob = CreateJobObjectW(lpJobAttributes, ((lpName != NULL) ? UnicodeName.Buffer : NULL)); @@ -69,12 +69,12 @@ CreateJobObjectW(LPSECURITY_ATTRIBUTES lpJobAttributes, PVOID SecurityDescriptor; HANDLE hJob; NTSTATUS Status; - + if(lpName != NULL) { RtlInitUnicodeString(&JobName, lpName); } - + if(lpJobAttributes != NULL) { if(lpJobAttributes->bInheritHandle) @@ -87,7 +87,7 @@ CreateJobObjectW(LPSECURITY_ATTRIBUTES lpJobAttributes, { SecurityDescriptor = NULL; } - + InitializeObjectAttributes(&ObjectAttributes, ((lpName != NULL) ? &JobName : NULL), Attributes, @@ -102,7 +102,7 @@ CreateJobObjectW(LPSECURITY_ATTRIBUTES lpJobAttributes, SetLastErrorByStatus(Status); return NULL; } - + return hJob; } @@ -120,21 +120,21 @@ OpenJobObjectW(DWORD dwDesiredAccess, UNICODE_STRING JobName; HANDLE hJob; NTSTATUS Status; - + if(lpName == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + RtlInitUnicodeString(&JobName, lpName); - + InitializeObjectAttributes(&ObjectAttributes, &JobName, (bInheritHandle ? OBJ_INHERIT : 0), NULL, NULL); - + Status = NtOpenJobObject(&hJob, dwDesiredAccess, &ObjectAttributes); @@ -170,7 +170,7 @@ OpenJobObjectA(DWORD dwDesiredAccess, SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + RtlInitAnsiString(&AnsiName, lpName); Status = RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE); if(!NT_SUCCESS(Status)) @@ -178,7 +178,7 @@ OpenJobObjectA(DWORD dwDesiredAccess, SetLastErrorByStatus(Status); return FALSE; } - + hJob = OpenJobObjectW(dwDesiredAccess, bInheritHandle, UnicodeName.Buffer); @@ -205,7 +205,7 @@ IsProcessInJob(HANDLE ProcessHandle, *Result = (Status == STATUS_PROCESS_IN_JOB); return TRUE; } - + SetLastErrorByStatus(Status); return FALSE; } @@ -243,7 +243,7 @@ QueryInformationJobObject(HANDLE hJob, LPDWORD lpReturnLength) { NTSTATUS Status; - + Status = NtQueryInformationJobObject(hJob, JobObjectInformationClass, lpJobObjectInformation, @@ -299,7 +299,7 @@ QueryInformationJobObject(HANDLE hJob, return TRUE; } - + SetLastErrorByStatus(Status); return FALSE; } @@ -380,7 +380,7 @@ SetInformationJobObject(HANDLE hJob, break; } } - + Status = NtSetInformationJobObject(hJob, JobObjectInformationClass, ObjectInfo, @@ -390,7 +390,7 @@ SetInformationJobObject(HANDLE hJob, SetLastErrorByStatus(Status); return FALSE; } - + return TRUE; } @@ -404,7 +404,7 @@ TerminateJobObject(HANDLE hJob, UINT uExitCode) { NTSTATUS Status; - + Status = NtTerminateJobObject(hJob, uExitCode); if(!NT_SUCCESS(Status)) { diff --git a/reactos/lib/kernel32/process/proc.c b/reactos/lib/kernel32/process/proc.c index 3994255954e..12d209b3806 100644 --- a/reactos/lib/kernel32/process/proc.c +++ b/reactos/lib/kernel32/process/proc.c @@ -39,7 +39,7 @@ GetProcessAffinityMask (HANDLE hProcess, PROCESS_BASIC_INFORMATION ProcessInfo; SYSTEM_BASIC_INFORMATION SystemInfo; NTSTATUS Status; - + Status = NtQuerySystemInformation(SystemBasicInformation, &SystemInfo, sizeof(SystemInfo), @@ -188,7 +188,7 @@ SetProcessWorkingSetSize(HANDLE hProcess, { QUOTA_LIMITS QuotaLimits; NTSTATUS Status; - + QuotaLimits.MinimumWorkingSetSize = dwMinimumWorkingSetSize; QuotaLimits.MaximumWorkingSetSize = dwMaximumWorkingSetSize; @@ -340,16 +340,16 @@ OpenProcess(DWORD dwDesiredAccess, HANDLE ProcessHandle; OBJECT_ATTRIBUTES ObjectAttributes; CLIENT_ID ClientId; - + ClientId.UniqueProcess = (HANDLE)dwProcessId; ClientId.UniqueThread = 0; - + InitializeObjectAttributes(&ObjectAttributes, NULL, (bInheritHandle ? OBJ_INHERIT : 0), NULL, NULL); - + errCode = NtOpenProcess(&ProcessHandle, dwDesiredAccess, &ObjectAttributes, @@ -552,7 +552,7 @@ FlushInstructionCache (HANDLE hProcess, DWORD dwSize) { NTSTATUS Status; - + Status = NtFlushInstructionCache(hProcess, (PVOID)lpBaseAddress, dwSize); @@ -574,13 +574,13 @@ ExitProcess(UINT uExitCode) CSRSS_API_REQUEST CsrRequest; CSRSS_API_REPLY CsrReply; NTSTATUS Status; - + /* unload all dll's */ LdrShutdownProcess (); /* notify csrss of process termination */ CsrRequest.Type = CSRSS_TERMINATE_PROCESS; - Status = CsrClientCallServer(&CsrRequest, + Status = CsrClientCallServer(&CsrRequest, &CsrReply, sizeof(CSRSS_API_REQUEST), sizeof(CSRSS_API_REPLY)); @@ -588,8 +588,8 @@ ExitProcess(UINT uExitCode) { DPRINT("Failed to tell csrss about terminating process\n"); } - - + + NtTerminateProcess (NtCurrentProcess (), uExitCode); @@ -627,7 +627,7 @@ FatalAppExitA (UINT uAction, { UNICODE_STRING MessageTextU; ANSI_STRING MessageText; - + RtlInitAnsiString (&MessageText, (LPSTR) lpMessageText); RtlAnsiStringToUnicodeString (&MessageTextU, @@ -669,7 +669,7 @@ GetPriorityClass (HANDLE hProcess) { NTSTATUS Status; PROCESS_PRIORITY_CLASS PriorityClass; - + Status = NtQueryInformationProcess(hProcess, ProcessPriorityClass, &PriorityClass, @@ -701,7 +701,7 @@ GetPriorityClass (HANDLE hProcess) return NORMAL_PRIORITY_CLASS; } } - + SetLastErrorByStatus(Status); return FALSE; } @@ -716,7 +716,7 @@ SetPriorityClass (HANDLE hProcess, { NTSTATUS Status; PROCESS_PRIORITY_CLASS PriorityClass; - + switch(dwPriorityClass) { case IDLE_PRIORITY_CLASS: @@ -747,7 +747,7 @@ SetPriorityClass (HANDLE hProcess, SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + PriorityClass.Foreground = FALSE; Status = NtSetInformationProcess(hProcess, @@ -760,7 +760,7 @@ SetPriorityClass (HANDLE hProcess, SetLastErrorByStatus(Status); return FALSE; } - + return TRUE; } @@ -783,7 +783,7 @@ GetProcessVersion (DWORD ProcessId) if (NULL != NtHeader) { Version = - (NtHeader->OptionalHeader.MajorOperatingSystemVersion << 16) | + (NtHeader->OptionalHeader.MajorOperatingSystemVersion << 16) | (NtHeader->OptionalHeader.MinorOperatingSystemVersion); } } @@ -817,7 +817,7 @@ GetProcessIoCounters( SetLastErrorByStatus(Status); return(FALSE); } - + return TRUE; } diff --git a/reactos/lib/kernel32/process/session.c b/reactos/lib/kernel32/process/session.c index 96b6ec7b5aa..b71f52bff20 100644 --- a/reactos/lib/kernel32/process/session.c +++ b/reactos/lib/kernel32/process/session.c @@ -32,7 +32,7 @@ DosPathToSessionPathW (DWORD SessionID, LPWSTR InPath, LPWSTR * OutPath) * ByVal pInPath As String, _ * ByVal ppOutPath As String ) _ * As Long - * + * * @unimplemented */ DWORD STDCALL @@ -53,18 +53,18 @@ BOOL STDCALL ProcessIdToSessionId (IN DWORD dwProcessId, CLIENT_ID ClientId; HANDLE ProcessHandle; NTSTATUS Status; - + if(IsBadWritePtr(pSessionId, sizeof(DWORD))) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + ClientId.UniqueProcess = (HANDLE)dwProcessId; ClientId.UniqueThread = INVALID_HANDLE_VALUE; InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL); - + Status = NtOpenProcess(&ProcessHandle, PROCESS_QUERY_INFORMATION, &ObjectAttributes, @@ -77,7 +77,7 @@ BOOL STDCALL ProcessIdToSessionId (IN DWORD dwProcessId, sizeof(SessionInformation), NULL); NtClose(ProcessHandle); - + if(NT_SUCCESS(Status)) { *pSessionId = SessionInformation.SessionId; diff --git a/reactos/lib/kernel32/string/lstring.c b/reactos/lib/kernel32/string/lstring.c index dde2bef9358..063ee03ee0f 100644 --- a/reactos/lib/kernel32/string/lstring.c +++ b/reactos/lib/kernel32/string/lstring.c @@ -22,7 +22,7 @@ lstrcmpA( ) { int Result; - + if (lpString1 == lpString2) return 0; if (lpString1 == NULL) @@ -32,7 +32,7 @@ lstrcmpA( Result = CompareStringA(GetThreadLocale(), 0, lpString1, -1, lpString2, -1); if (Result) Result -= 2; - + return Result; } @@ -48,7 +48,7 @@ lstrcmpiA( ) { int Result; - + if (lpString1 == lpString2) return 0; if (lpString1 == NULL) @@ -59,7 +59,7 @@ lstrcmpiA( Result = CompareStringA(GetThreadLocale(), NORM_IGNORECASE, lpString1, -1, lpString2, -1); if (Result) Result -= 2; - + return Result; } @@ -171,7 +171,7 @@ lstrcmpW( ) { int Result; - + if (lpString1 == lpString2) return 0; if (lpString1 == NULL) @@ -181,7 +181,7 @@ lstrcmpW( Result = CompareStringW(GetThreadLocale(), 0, lpString1, -1, lpString2, -1); if (Result) Result -= 2; - + return Result; } @@ -197,7 +197,7 @@ lstrcmpiW( ) { int Result; - + if (lpString1 == lpString2) return 0; if (lpString1 == NULL) @@ -207,7 +207,7 @@ lstrcmpiW( Result = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, lpString1, -1, lpString2, -1); if (Result) Result -= 2; - + return Result; } @@ -272,7 +272,7 @@ lstrcpyW( return NULL; } - return wcscpy(lpString1,lpString2); + return wcscpy(lpString1,lpString2); } diff --git a/reactos/lib/kernel32/synch/critical.c b/reactos/lib/kernel32/synch/critical.c index 87810c8e021..03147c098b3 100644 --- a/reactos/lib/kernel32/synch/critical.c +++ b/reactos/lib/kernel32/synch/critical.c @@ -44,7 +44,7 @@ InitializeCriticalSectionAndSpinCount( ) { NTSTATUS Status; - + Status = RtlInitializeCriticalSectionAndSpinCount((PRTL_CRITICAL_SECTION)lpCriticalSection, dwSpinCount); if (Status) { diff --git a/reactos/lib/kernel32/synch/intrlck.c b/reactos/lib/kernel32/synch/intrlck.c index 086a60f199e..bf834bd8f87 100644 --- a/reactos/lib/kernel32/synch/intrlck.c +++ b/reactos/lib/kernel32/synch/intrlck.c @@ -32,20 +32,20 @@ * @implemented * ************************************************************************/ -LONG -STDCALL +LONG +STDCALL InterlockedIncrement(PLONG Addend) { long ret = 0; __asm__ - ( + ( "\tlock\n" /* for SMP systems */ "\tincl (%1)\n" "\tje 2f\n" "\tjl 1f\n" "\tincl %0\n" "\tjmp 2f\n" - "1:\tdec %0\n" + "1:\tdec %0\n" "2:\n" :"=r" (ret):"r" (Addend), "0" (0): "memory" ); @@ -66,22 +66,22 @@ InterlockedIncrement(PLONG Addend) * @implemented * ************************************************************************/ -LONG +LONG STDCALL InterlockedDecrement(LPLONG lpAddend) { long ret; __asm__ - ( + ( "\tlock\n" /* for SMP systems */ "\tdecl (%1)\n" "\tje 2f\n" "\tjl 1f\n" "\tincl %0\n" "\tjmp 2f\n" - "1:\tdec %0\n" + "1:\tdec %0\n" "2:\n" - :"=r" (ret):"r" (lpAddend), "0" (0): "memory" + :"=r" (ret):"r" (lpAddend), "0" (0): "memory" ); return ret; @@ -89,7 +89,7 @@ InterlockedDecrement(LPLONG lpAddend) } /************************************************************************ - * InterlockedExchange + * InterlockedExchange * * Atomically exchanges a pair of values. * @@ -98,11 +98,11 @@ InterlockedDecrement(LPLONG lpAddend) * * @implemented */ -LONG -STDCALL +LONG +STDCALL InterlockedExchange(LPLONG target, LONG value ) { - + long ret; __asm__ ( /* lock for SMP systems */ "lock\n\txchgl %0,(%1)" @@ -113,7 +113,7 @@ InterlockedExchange(LPLONG target, LONG value ) } /************************************************************************ - * InterlockedCompareExchange + * InterlockedCompareExchange * * Atomically compares Destination and Comperand, and if found equal exchanges * the value of Destination with Exchange @@ -123,13 +123,13 @@ InterlockedExchange(LPLONG target, LONG value ) * * @implemented */ -LONG -STDCALL +LONG +STDCALL InterlockedCompareExchange( - PLONG Destination, - LONG Exchange, - LONG Comperand ) -{ + PLONG Destination, + LONG Exchange, + LONG Comperand ) +{ LONG ret; __asm__ ( /* lock for SMP systems */ "lock\n\t" @@ -141,7 +141,7 @@ InterlockedCompareExchange( } /************************************************************************ - * InterlockedExchangeAdd + * InterlockedExchangeAdd * * Atomically adds Increment to Addend and returns the previous value of * Addend @@ -151,12 +151,12 @@ InterlockedCompareExchange( * * @implemented */ -LONG -STDCALL +LONG +STDCALL InterlockedExchangeAdd( - PLONG Addend, - LONG Increment -) + PLONG Addend, + LONG Increment +) { LONG ret; diff --git a/reactos/lib/kernel32/synch/timer.c b/reactos/lib/kernel32/synch/timer.c index ea78ade01bd..ebfdaa31413 100644 --- a/reactos/lib/kernel32/synch/timer.c +++ b/reactos/lib/kernel32/synch/timer.c @@ -4,7 +4,7 @@ * PROJECT: ReactOS kernel * FILE: lib/kernel32/synch/timer.c * PURPOSE: Implementing timer - * PROGRAMMER: + * PROGRAMMER: */ /* INCLUDES ******************************************************************/ @@ -40,7 +40,7 @@ CreateWaitableTimerW(LPSECURITY_ATTRIBUTES lpTimerAttributes, 0, hBaseDir, NULL); - + if (lpTimerAttributes != NULL) { ObjectAttributes.SecurityDescriptor = lpTimerAttributes->lpSecurityDescriptor; @@ -49,7 +49,7 @@ CreateWaitableTimerW(LPSECURITY_ATTRIBUTES lpTimerAttributes, ObjectAttributes.Attributes |= OBJ_INHERIT; } } - + Status = NtCreateTimer(&TimerHandle, TIMER_ALL_ACCESS, &ObjectAttributes, @@ -110,7 +110,7 @@ OpenWaitableTimerW(DWORD dwDesiredAccess, HANDLE TimerHandle; OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING UnicodeName; - + if (lpTimerName == NULL) { SetLastErrorByStatus(STATUS_INVALID_PARAMETER); @@ -149,7 +149,7 @@ OpenWaitableTimerA(DWORD dwDesiredAccess, UNICODE_STRING TimerNameU; ANSI_STRING TimerName; HANDLE TimerHandle; - + if (lpTimerName == NULL) { SetLastErrorByStatus(STATUS_INVALID_PARAMETER); diff --git a/reactos/lib/kernel32/synch/wait.c b/reactos/lib/kernel32/synch/wait.c index 7538891dadb..4b7b4c5243c 100644 --- a/reactos/lib/kernel32/synch/wait.c +++ b/reactos/lib/kernel32/synch/wait.c @@ -71,7 +71,7 @@ WaitForSingleObjectEx(HANDLE hHandle, SetLastError (ERROR_INVALID_HANDLE); return WAIT_FAILED; } - + hHandle = (HANDLE)GetConsoleInputWaitHandle(); if (hHandle == NULL || hHandle == INVALID_HANDLE_VALUE) { diff --git a/reactos/lib/kernel32/thread/fiber.c b/reactos/lib/kernel32/thread/fiber.c index da9e8c0964b..cbe8d425f11 100644 --- a/reactos/lib/kernel32/thread/fiber.c +++ b/reactos/lib/kernel32/thread/fiber.c @@ -230,11 +230,11 @@ LPVOID WINAPI CreateFiberEx if(dwFlags & FIBER_FLAG_FLOAT_SWITCH) pfCurFiber->FloatSave = ctxFiberContext.FloatSave; - + #else #error Unspecified or unsupported architecture. #endif - + return pfCurFiber; l_CleanupStack: diff --git a/reactos/lib/kernel32/thread/fls.c b/reactos/lib/kernel32/thread/fls.c index 9a62d27a0c9..a0ec78a2a2a 100644 --- a/reactos/lib/kernel32/thread/fls.c +++ b/reactos/lib/kernel32/thread/fls.c @@ -48,16 +48,16 @@ PVOID WINAPI FlsGetValue(DWORD dwFlsIndex) { PVOID * ppFlsSlots; PVOID pRetVal; - + if(dwFlsIndex >= 128) goto l_InvalidParam; ppFlsSlots = NtCurrentTeb()->FlsSlots; - + if(ppFlsSlots == NULL) goto l_InvalidParam; SetLastError(0); pRetVal = ppFlsSlots[dwFlsIndex + 2]; - + return pRetVal; l_InvalidParam: @@ -101,13 +101,13 @@ BOOL WINAPI FlsSetValue(DWORD dwFlsIndex, PVOID lpFlsData) } ppFlsSlots[dwFlsIndex + 2] = lpFlsData; - + return TRUE; l_OutOfMemory: SetLastError(ERROR_NOT_ENOUGH_MEMORY); goto l_Fail; - + l_InvalidParam: SetLastError(ERROR_INVALID_PARAMETER); diff --git a/reactos/lib/kernel32/thread/thread.c b/reactos/lib/kernel32/thread/thread.c index 1caf587686e..06b11a24271 100644 --- a/reactos/lib/kernel32/thread/thread.c +++ b/reactos/lib/kernel32/thread/thread.c @@ -188,7 +188,7 @@ CreateRemoteThread NULL, NULL ); - + if(lpThreadAttributes) { /* make the handle inheritable */ @@ -253,7 +253,7 @@ CreateRemoteThread SetLastErrorByStatus(nErrCode); return NULL; } - + DPRINT ( "StackReserve %p\n" @@ -287,16 +287,16 @@ OpenThread( HANDLE ThreadHandle; OBJECT_ATTRIBUTES ObjectAttributes; CLIENT_ID ClientId ; - + ClientId.UniqueProcess = INVALID_HANDLE_VALUE; ClientId.UniqueThread = (HANDLE)dwThreadId; - + InitializeObjectAttributes (&ObjectAttributes, NULL, (bInheritHandle ? OBJ_INHERIT : 0), NULL, NULL); - + errCode = NtOpenThread(&ThreadHandle, dwDesiredAccess, &ObjectAttributes, @@ -398,13 +398,13 @@ GetThreadTimes(HANDLE hThread, lpCreationTime->dwLowDateTime = KernelUserTimes.CreateTime.u.LowPart; lpCreationTime->dwHighDateTime = KernelUserTimes.CreateTime.u.HighPart; - + lpExitTime->dwLowDateTime = KernelUserTimes.ExitTime.u.LowPart; lpExitTime->dwHighDateTime = KernelUserTimes.ExitTime.u.HighPart; - + lpKernelTime->dwLowDateTime = KernelUserTimes.KernelTime.u.LowPart; lpKernelTime->dwHighDateTime = KernelUserTimes.KernelTime.u.HighPart; - + lpUserTime->dwLowDateTime = KernelUserTimes.UserTime.u.LowPart; lpUserTime->dwHighDateTime = KernelUserTimes.UserTime.u.HighPart; @@ -697,7 +697,7 @@ GetThreadSelectorEntry(IN HANDLE hThread, { DESCRIPTOR_TABLE_ENTRY DescriptionTableEntry; NTSTATUS Status; - + DescriptionTableEntry.Selector = dwSelector; Status = NtQueryInformationThread(hThread, ThreadDescriptorTableEntry, @@ -826,13 +826,13 @@ GetThreadIOPendingFlag(HANDLE hThread, { ULONG IoPending; NTSTATUS Status; - + if(lpIOIsPending == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + Status = NtQueryInformationThread(hThread, ThreadIsIoPending, (PVOID)&IoPending, @@ -843,7 +843,7 @@ GetThreadIOPendingFlag(HANDLE hThread, *lpIOIsPending = ((IoPending != 0) ? TRUE : FALSE); return TRUE; } - + SetLastErrorByStatus(Status); return FALSE; } diff --git a/reactos/lib/kernel32/thread/tls.c b/reactos/lib/kernel32/thread/tls.c index 894a30e87de..767f4734b33 100644 --- a/reactos/lib/kernel32/thread/tls.c +++ b/reactos/lib/kernel32/thread/tls.c @@ -23,7 +23,7 @@ /* * @implemented */ -DWORD STDCALL +DWORD STDCALL TlsAlloc(VOID) { ULONG Index; @@ -39,7 +39,7 @@ TlsAlloc(VOID) NtCurrentTeb()->TlsSlots[Index] = 0; } RtlReleasePebLock(); - + return(Index); } @@ -47,7 +47,7 @@ TlsAlloc(VOID) /* * @implemented */ -BOOL STDCALL +BOOL STDCALL TlsFree(DWORD dwTlsIndex) { if (dwTlsIndex >= TLS_MINIMUM_AVAILABLE) @@ -80,7 +80,7 @@ TlsFree(DWORD dwTlsIndex) /* * @implemented */ -LPVOID STDCALL +LPVOID STDCALL TlsGetValue(DWORD dwTlsIndex) { LPVOID Value; @@ -103,7 +103,7 @@ TlsGetValue(DWORD dwTlsIndex) /* * @implemented */ -BOOL STDCALL +BOOL STDCALL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) { if (dwTlsIndex >= TLS_MINIMUM_AVAILABLE)