Reactos

[KERNEL32] Don't hardcode some types in sizeofs, and some flag values.

+15 -15
+14 -14
dll/win32/kernel32/client/file/npipe.c
··· 76 76 77 77 /* Restore the thread token */ 78 78 Status = NtSetInformationThread(NtCurrentThread(), ThreadImpersonationToken, 79 - &hToken, sizeof(HANDLE)); 79 + &hToken, sizeof(hToken)); 80 80 /* We cannot fail closing the thread token! */ 81 81 if (!CloseHandle(hToken)) 82 82 { ··· 169 169 170 170 /* Create the named pipe */ 171 171 Status = NtCreateNamedPipeFile(&ReadPipeHandle, 172 - GENERIC_READ |FILE_WRITE_ATTRIBUTES | SYNCHRONIZE, 172 + GENERIC_READ | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE, 173 173 &ObjectAttributes, 174 174 &StatusBlock, 175 175 FILE_SHARE_READ | FILE_SHARE_WRITE, ··· 296 296 297 297 /* Always case insensitive, check if we got extra attributes */ 298 298 Attributes = OBJ_CASE_INSENSITIVE; 299 - if(lpSecurityAttributes) 299 + if (lpSecurityAttributes) 300 300 { 301 301 /* We did; get the security descriptor */ 302 302 SecurityDescriptor = lpSecurityAttributes->lpSecurityDescriptor; ··· 790 790 791 791 /* Set the Read Mode */ 792 792 Settings.ReadMode = (*lpMode & PIPE_READMODE_MESSAGE) ? 793 - FILE_PIPE_MESSAGE_MODE: FILE_PIPE_BYTE_STREAM_MODE; 793 + FILE_PIPE_MESSAGE_MODE : FILE_PIPE_BYTE_STREAM_MODE; 794 794 795 795 /* Send the changes to the Driver */ 796 796 Status = NtSetInformationFile(hNamedPipe, 797 797 &Iosb, 798 798 &Settings, 799 - sizeof(FILE_PIPE_INFORMATION), 799 + sizeof(Settings), 800 800 FilePipeInformation); 801 801 if (!NT_SUCCESS(Status)) 802 802 { ··· 816 816 Status = NtQueryInformationFile(hNamedPipe, 817 817 &Iosb, 818 818 &RemoteSettings, 819 - sizeof(FILE_PIPE_REMOTE_INFORMATION), 819 + sizeof(RemoteSettings), 820 820 FilePipeRemoteInformation); 821 821 if (!NT_SUCCESS(Status)) 822 822 { ··· 839 839 Status = NtSetInformationFile(hNamedPipe, 840 840 &Iosb, 841 841 &RemoteSettings, 842 - sizeof(FILE_PIPE_REMOTE_INFORMATION), 842 + sizeof(RemoteSettings), 843 843 FilePipeRemoteInformation); 844 844 if (!NT_SUCCESS(Status)) 845 845 { ··· 1017 1017 Status = NtQueryInformationFile(hNamedPipe, 1018 1018 &StatusBlock, 1019 1019 &PipeInfo, 1020 - sizeof(FILE_PIPE_INFORMATION), 1020 + sizeof(PipeInfo), 1021 1021 FilePipeInformation); 1022 1022 if (!NT_SUCCESS(Status)) 1023 1023 { ··· 1029 1029 *lpState |= ((PipeInfo.ReadMode != FILE_PIPE_BYTE_STREAM_MODE) ? PIPE_READMODE_MESSAGE : PIPE_READMODE_BYTE); 1030 1030 } 1031 1031 1032 - if(lpCurInstances != NULL) 1032 + if (lpCurInstances != NULL) 1033 1033 { 1034 1034 FILE_PIPE_LOCAL_INFORMATION LocalInfo; 1035 1035 1036 1036 Status = NtQueryInformationFile(hNamedPipe, 1037 1037 &StatusBlock, 1038 1038 &LocalInfo, 1039 - sizeof(FILE_PIPE_LOCAL_INFORMATION), 1039 + sizeof(LocalInfo), 1040 1040 FilePipeLocalInformation); 1041 1041 if (!NT_SUCCESS(Status)) 1042 1042 { ··· 1054 1054 Status = NtQueryInformationFile(hNamedPipe, 1055 1055 &StatusBlock, 1056 1056 &RemoteInfo, 1057 - sizeof(FILE_PIPE_REMOTE_INFORMATION), 1057 + sizeof(RemoteInfo), 1058 1058 FilePipeRemoteInformation); 1059 1059 if (!NT_SUCCESS(Status)) 1060 1060 { ··· 1112 1112 ANSI_STRING UserNameA; 1113 1113 BOOL Ret; 1114 1114 1115 - if(lpUserName != NULL) 1115 + if (lpUserName != NULL) 1116 1116 { 1117 1117 UserNameW.MaximumLength = (USHORT)nMaxUserNameSize * sizeof(WCHAR); 1118 1118 UserNameW.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, UserNameW.MaximumLength); ··· 1174 1174 Status = NtQueryInformationFile(hNamedPipe, 1175 1175 &StatusBlock, 1176 1176 &PipeLocalInformation, 1177 - sizeof(FILE_PIPE_LOCAL_INFORMATION), 1177 + sizeof(PipeLocalInformation), 1178 1178 FilePipeLocalInformation); 1179 1179 if (!NT_SUCCESS(Status)) 1180 1180 { ··· 1185 1185 if (lpFlags != NULL) 1186 1186 { 1187 1187 *lpFlags = (PipeLocalInformation.NamedPipeEnd == FILE_PIPE_SERVER_END) ? PIPE_SERVER_END : PIPE_CLIENT_END; 1188 - *lpFlags |= (PipeLocalInformation.NamedPipeType == 1) ? PIPE_TYPE_MESSAGE : PIPE_TYPE_BYTE; 1188 + *lpFlags |= (PipeLocalInformation.NamedPipeType == FILE_PIPE_MESSAGE_TYPE) ? PIPE_TYPE_MESSAGE : PIPE_TYPE_BYTE; 1189 1189 } 1190 1190 1191 1191 if (lpOutBufferSize != NULL)
+1 -1
dll/win32/kernel32/client/loader.c
··· 677 677 if (NT_SUCCESS(Status)) return Module; 678 678 679 679 /* If not, then the path should be computed */ 680 - DllPath = BaseComputeProcessDllPath(NULL, 0); 680 + DllPath = BaseComputeProcessDllPath(NULL, NULL); 681 681 if (!DllPath) 682 682 { 683 683 Status = STATUS_NO_MEMORY;