"Eric Pouech" pouech-eric@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 2. Why you don't pass buffer directly to RtlGetFullPathName_U without allocating an intermediate storage.
Dmitry Timoshkov a e'crit :
"Eric Pouech" pouech-eric@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:
- HeapAlloc(GetProcessHeap(), 0, len * sizeof(buffer)) when buffer is
a pointer
good catch
- 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+