ntdll / kernel32 #39-2

Eric Pouech pouech-eric at wanadoo.fr
Sun Jan 18 03:11:42 CST 2004


Dmitry Timoshkov a e'crit :
> "Eric Pouech" <pouech-eric at wanadoo.fr> wrote:
> 
> 
>>+DWORD WINAPI GetFullPathNameW( LPCWSTR name, DWORD len, LPWSTR buffer,
>>+                               LPWSTR *lastpart )
>>+{
>>+    LPWSTR      dst = HeapAlloc(GetProcessHeap(), 0, len * sizeof(buffer));
>>+    DWORD       ret;
>>+
>>+    if (!dst) return 0;
>>+    ret = RtlGetFullPathName_U(name, len * sizeof(WCHAR), dst, lastpart) / sizeof(WCHAR);
> 
> 
> I don't quite understand the above bit of code:
> 
> 1. HeapAlloc(GetProcessHeap(), 0, len * sizeof(buffer)) when buffer is
> a pointer
good catch
> 2. Why you don't pass buffer directly to RtlGetFullPathName_U without 
> allocating an intermediate storage.
because RtlGetFullPathName_U is buggy when name = buffer (it would be 
better anyway to fix RtlGetFullPathName_U to support that case).

A+




More information about the wine-devel mailing list