INT WINAPI GetPrivateProfileSectionW( LPCWSTR section, LPWSTR buffer,
DWORD len, LPCWSTR filename )
{
- int ret = 0;
+ int ret = 0;
+
+ if (!section || !buffer)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
TRACE("(%s, %p, %d, %s)\n", debugstr_w(section), buffer, len, debugstr_w(filename));
LPWSTR bufferW;
INT retW, ret = 0;
- bufferW = buffer ? HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)) : NULL;
- if (section) RtlCreateUnicodeStringFromAsciiz(§ionW, section);
- else sectionW.Buffer = NULL;
+ if (!section || !buffer)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
+
+ bufferW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ RtlCreateUnicodeStringFromAsciiz(§ionW, section);
if (filename) RtlCreateUnicodeStringFromAsciiz(&filenameW, filename);
else filenameW.Buffer = NULL;
else
ret = ret-1;
}
+ else if(size)
+ buffer[0] = '\0';
RtlFreeUnicodeString(&filenameW);
HeapFree(GetProcessHeap(), 0, bufferW);