@@ -3529,7 +3529,7 @@ VOID PhShellOpenKey(
3529
3529
3530
3530
RtlInitUnicodeString (& valueName , L"LastKey" );
3531
3531
lastKey = PhExpandKeyName (KeyName , TRUE);
3532
- NtSetValueKey (regeditKeyHandle , & valueName , 0 , REG_SZ , lastKey -> Buffer , (ULONG )lastKey -> Length + 2 );
3532
+ NtSetValueKey (regeditKeyHandle , & valueName , 0 , REG_SZ , lastKey -> Buffer , (ULONG )lastKey -> Length + sizeof ( UNICODE_NULL ) );
3533
3533
PhDereferenceObject (lastKey );
3534
3534
3535
3535
NtClose (regeditKeyHandle );
@@ -3583,8 +3583,8 @@ PPH_STRING PhQueryRegistryString(
3583
3583
buffer -> Type == REG_MULTI_SZ ||
3584
3584
buffer -> Type == REG_EXPAND_SZ )
3585
3585
{
3586
- if (buffer -> DataLength >= sizeof (WCHAR ))
3587
- string = PhCreateStringEx ((PWCHAR )buffer -> Data , buffer -> DataLength - sizeof (WCHAR ));
3586
+ if (buffer -> DataLength >= sizeof (UNICODE_NULL ))
3587
+ string = PhCreateStringEx ((PWCHAR )buffer -> Data , buffer -> DataLength - sizeof (UNICODE_NULL ));
3588
3588
else
3589
3589
string = PhReferenceEmptyString ();
3590
3590
}
@@ -3786,9 +3786,7 @@ OPENFILENAME *PhpCreateOpenFileName(
3786
3786
{
3787
3787
OPENFILENAME * ofn ;
3788
3788
3789
- ofn = PhAllocate (sizeof (OPENFILENAME ));
3790
- memset (ofn , 0 , sizeof (OPENFILENAME ));
3791
-
3789
+ ofn = PhAllocateZero (sizeof (OPENFILENAME ));
3792
3790
ofn -> lStructSize = sizeof (OPENFILENAME );
3793
3791
ofn -> nMaxFile = 0x400 ;
3794
3792
ofn -> lpstrFile = PhAllocate (ofn -> nMaxFile * sizeof (WCHAR ));
@@ -3939,7 +3937,7 @@ VOID PhFreeFileDialog(
3939
3937
* occurred.
3940
3938
*/
3941
3939
BOOLEAN PhShowFileDialog (
3942
- _In_ HWND hWnd ,
3940
+ _In_opt_ HWND hWnd ,
3943
3941
_In_ PVOID FileDialog
3944
3942
)
3945
3943
{
@@ -4186,7 +4184,7 @@ VOID PhSetFileDialogFilter(
4186
4184
if (ofn -> lpstrFilter )
4187
4185
PhFree ((PVOID )ofn -> lpstrFilter );
4188
4186
4189
- ofn -> lpstrFilter = PhAllocateCopy (filterString -> Buffer , filterString -> Length + 2 );
4187
+ ofn -> lpstrFilter = PhAllocateCopy (filterString -> Buffer , filterString -> Length + sizeof ( UNICODE_NULL ) );
4190
4188
PhDereferenceObject (filterString );
4191
4189
}
4192
4190
}
0 commit comments