/* clear result string */
Length = 0;
}
- lpszFormatName[Length] = '\0';
+ lpszFormatName[Length] = ANSI_NULL;
}
RtlFreeHeap(RtlGetProcessHeap(), 0, lpBuffer);
WINAPI
RegisterClipboardFormatA(LPCSTR lpszFormat)
{
- UINT ret = 0;
+ UINT ret;
UNICODE_STRING usFormat = {0};
if (lpszFormat == NULL)
return 0;
}
- /* check for "" */
- if (*lpszFormat == 0) //NULL
+ if (*lpszFormat == ANSI_NULL)
{
SetLastError(ERROR_INVALID_NAME);
return 0;
}
- ret = RtlCreateUnicodeStringFromAsciiz(&usFormat, lpszFormat);
- if (ret)
+ if (!RtlCreateUnicodeStringFromAsciiz(&usFormat, lpszFormat))
{
- ret = NtUserRegisterWindowMessage(&usFormat); //(LPCWSTR)
- RtlFreeUnicodeString(&usFormat);
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return 0;
}
+ ret = NtUserRegisterWindowMessage(&usFormat); //(LPCWSTR)
+
+ RtlFreeUnicodeString(&usFormat);
+
return ret;
}
WINAPI
RegisterClipboardFormatW(LPCWSTR lpszFormat)
{
- UINT ret = 0;
UNICODE_STRING usFormat = {0};
if (lpszFormat == NULL)
return 0;
}
- /* check for "" */
- if (*lpszFormat == 0) //NULL
+ if (*lpszFormat == UNICODE_NULL)
{
SetLastError(ERROR_INVALID_NAME);
return 0;
}
RtlInitUnicodeString(&usFormat, lpszFormat);
- ret = NtUserRegisterWindowMessage(&usFormat);
-
- return ret;
+ return NtUserRegisterWindowMessage(&usFormat);
}
static PVOID WINAPI
DWORD dwSize;
HANDLE hGlobal;
LPVOID pMem;
- HANDLE hRet = NULL;
+ HANDLE hRet = NULL, hTemp;
SETCLIPBDATA scd = {FALSE, FALSE};
/* Check if this is a delayed rendering */
/* Meta files are probably checked for validity */
else if (uFormat == CF_DSPMETAFILEPICT || uFormat == CF_METAFILEPICT )
{
- hMem = GdiConvertMetaFilePict( hMem );
- hRet = NtUserSetClipboardData(uFormat, hMem, &scd);
+ hTemp = GdiConvertMetaFilePict( hMem );
+ hRet = NtUserSetClipboardData(uFormat, hTemp, &scd); // Note : LOL, it returns a BOOL not a HANDLE!!!!
+ if (hRet == hTemp) hRet = hMem; // If successful "TRUE", return the original handle.
}
else if (uFormat == CF_DSPENHMETAFILE || uFormat == CF_ENHMETAFILE)
{
- hMem = GdiConvertEnhMetaFile( hMem );
- hRet = NtUserSetClipboardData(uFormat, hMem, &scd);
+ hTemp = GdiConvertEnhMetaFile( hMem );
+ hRet = NtUserSetClipboardData(uFormat, hTemp, &scd);
+ if (hRet == hTemp) hRet = hMem;
}
else
{