[KERNEL32]

- Fix some style issues in DefineDosDevice

svn path=/trunk/; revision=63851
This commit is contained in:
Thomas Faber 2014-08-10 16:20:43 +00:00
parent a56fcb9ae3
commit 39f3c7d584

View file

@ -35,22 +35,18 @@ DefineDosDeviceA(
BOOL Result; BOOL Result;
if (lpDeviceName && if (lpDeviceName &&
! RtlCreateUnicodeStringFromAsciiz(&DeviceNameU, !RtlCreateUnicodeStringFromAsciiz(&DeviceNameU, lpDeviceName))
(LPSTR)lpDeviceName))
{ {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return 0; return 0;
} }
if (lpTargetPath && if (lpTargetPath &&
! RtlCreateUnicodeStringFromAsciiz(&TargetPathU, !RtlCreateUnicodeStringFromAsciiz(&TargetPathU, lpTargetPath))
(LPSTR)lpTargetPath))
{ {
if (DeviceNameU.Buffer) if (DeviceNameU.Buffer)
{ {
RtlFreeHeap(RtlGetProcessHeap (), RtlFreeUnicodeString(&DeviceNameU);
0,
DeviceNameU.Buffer);
} }
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return 0; return 0;
@ -62,16 +58,12 @@ DefineDosDeviceA(
if (TargetPathU.Buffer) if (TargetPathU.Buffer)
{ {
RtlFreeHeap(RtlGetProcessHeap (), RtlFreeUnicodeString(&TargetPathU);
0,
TargetPathU.Buffer);
} }
if (DeviceNameU.Buffer) if (DeviceNameU.Buffer)
{ {
RtlFreeHeap(RtlGetProcessHeap (), RtlFreeUnicodeString(&DeviceNameU);
0,
DeviceNameU.Buffer);
} }
return Result; return Result;
} }
@ -114,7 +106,7 @@ DefineDosDeviceW(
ArgumentCount = 1; ArgumentCount = 1;
BufferSize = 0; BufferSize = 0;
if (! lpTargetPath) if (!lpTargetPath)
{ {
RtlInitUnicodeString(&NtTargetPathU, RtlInitUnicodeString(&NtTargetPathU,
NULL); NULL);
@ -128,10 +120,10 @@ DefineDosDeviceW(
} }
else else
{ {
if (! RtlDosPathNameToNtPathName_U(lpTargetPath, if (!RtlDosPathNameToNtPathName_U(lpTargetPath,
&NtTargetPathU, &NtTargetPathU,
0, NULL,
0)) NULL))
{ {
WARN("RtlDosPathNameToNtPathName_U() failed\n"); WARN("RtlDosPathNameToNtPathName_U() failed\n");
BaseSetLastNTError(STATUS_OBJECT_NAME_INVALID); BaseSetLastNTError(STATUS_OBJECT_NAME_INVALID);
@ -151,7 +143,7 @@ DefineDosDeviceW(
CaptureBuffer = CsrAllocateCaptureBuffer(ArgumentCount, CaptureBuffer = CsrAllocateCaptureBuffer(ArgumentCount,
BufferSize); BufferSize);
if (! CaptureBuffer) if (!CaptureBuffer)
{ {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
Result = FALSE; Result = FALSE;
@ -161,7 +153,7 @@ DefineDosDeviceW(
DefineDosDeviceRequest->Flags = dwFlags; DefineDosDeviceRequest->Flags = dwFlags;
CsrCaptureMessageBuffer(CaptureBuffer, CsrCaptureMessageBuffer(CaptureBuffer,
(PVOID)DeviceUpcaseNameU.Buffer, DeviceUpcaseNameU.Buffer,
DeviceUpcaseNameU.Length, DeviceUpcaseNameU.Length,
(PVOID*)&DefineDosDeviceRequest->DeviceName.Buffer); (PVOID*)&DefineDosDeviceRequest->DeviceName.Buffer);
@ -173,7 +165,7 @@ DefineDosDeviceW(
if (NtTargetPathU.Buffer) if (NtTargetPathU.Buffer)
{ {
CsrCaptureMessageBuffer(CaptureBuffer, CsrCaptureMessageBuffer(CaptureBuffer,
(PVOID)NtTargetPathU.Buffer, NtTargetPathU.Buffer,
NtTargetPathU.Length, NtTargetPathU.Length,
(PVOID*)&DefineDosDeviceRequest->TargetPath.Buffer); (PVOID*)&DefineDosDeviceRequest->TargetPath.Buffer);
} }
@ -212,7 +204,7 @@ DefineDosDeviceW(
dbcv.dbcv_size = sizeof(DEV_BROADCAST_VOLUME); dbcv.dbcv_size = sizeof(DEV_BROADCAST_VOLUME);
dbcv.dbcv_devicetype = DBT_DEVTYP_VOLUME; dbcv.dbcv_devicetype = DBT_DEVTYP_VOLUME;
dbcv.dbcv_reserved = 0; dbcv.dbcv_reserved = 0;
dbcv.dbcv_unitmask |= dbcv.dbcv_unitmask |=
(1 << (DeviceUpcaseNameU.Buffer[0] - L'A')); (1 << (DeviceUpcaseNameU.Buffer[0] - L'A'));
dbcv.dbcv_flags = DBTF_NET; dbcv.dbcv_flags = DBTF_NET;
(void) BSM_ptr(BSF_SENDNOTIFYMESSAGE | BSF_FLUSHDISK, (void) BSM_ptr(BSF_SENDNOTIFYMESSAGE | BSF_FLUSHDISK,
@ -293,7 +285,7 @@ QueryDosDeviceA(
{ {
CurrentLength = min (ucchMax, MAXUSHORT / 2); CurrentLength = min (ucchMax, MAXUSHORT / 2);
TargetPathU.MaximumLength = TargetPathU.Length = (USHORT)CurrentLength * sizeof(WCHAR); TargetPathU.MaximumLength = TargetPathU.Length = (USHORT)CurrentLength * sizeof(WCHAR);
TargetPathA.Length = 0; TargetPathA.Length = 0;
TargetPathA.MaximumLength = (USHORT)CurrentLength; TargetPathA.MaximumLength = (USHORT)CurrentLength;