/* * @unimplemented */ BOOL WINAPI GetICMProfileA( HDC hdc, LPDWORD pBufSize, LPSTR pszFilename ) { WCHAR filenameW[MAX_PATH]; DWORD buflen = MAX_PATH; BOOL ret = FALSE; if (!hdc || !pBufSize || !pszFilename) return FALSE; if (GetICMProfileW(hdc, &buflen, filenameW)) { ULONG len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL); if (*pBufSize >= len) { WideCharToMultiByte(CP_ACP, 0, filenameW, -1, pszFilename, *pBufSize, NULL, NULL); ret = TRUE; } else SetLastError(ERROR_INSUFFICIENT_BUFFER); *pBufSize = len; } return ret; }
static void test_GetICMProfileW( HDC dc ) { BOOL ret; DWORD size, error; WCHAR filename[MAX_PATH]; SetLastError( 0xdeadbeef ); ret = GetICMProfileW( NULL, NULL, NULL ); if ( !ret && ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) ) { win_skip( "GetICMProfileW is not implemented\n" ); return; } ok( !ret, "GetICMProfileW succeeded\n" ); ret = GetICMProfileW( dc, NULL, NULL ); ok( !ret, "GetICMProfileW succeeded\n" ); if (0) { /* Vista crashes */ size = MAX_PATH; ret = GetICMProfileW( dc, &size, NULL ); ok( ret, "GetICMProfileW failed %d\n", GetLastError() ); } ret = GetICMProfileW( dc, NULL, filename ); ok( !ret, "GetICMProfileW succeeded\n" ); size = MAX_PATH; ret = GetICMProfileW( NULL, &size, filename ); ok( !ret, "GetICMProfileW succeeded\n" ); size = 0; SetLastError(0xdeadbeef); ret = GetICMProfileW( dc, &size, filename ); error = GetLastError(); ok( !ret, "GetICMProfileW succeeded\n" ); ok( size, "expected size > 0\n" ); ok( error == ERROR_INSUFFICIENT_BUFFER, "got %d, expected ERROR_INSUFFICIENT_BUFFER\n", error ); size = MAX_PATH; ret = GetICMProfileW( dc, &size, filename ); ok( ret, "GetICMProfileW failed %d\n", GetLastError() ); }
static void test_SetICMProfileW( HDC dc ) { BOOL ret; WCHAR profile[MAX_PATH]; DWORD len, error; SetLastError( 0xdeadbeef ); ret = SetICMProfileW( NULL, NULL ); if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) { win_skip("SetICMProfileW is not implemented\n"); return; } len = sizeof(profile)/sizeof(profile[0]); ret = GetICMProfileW( dc, &len, profile ); ok(ret, "GetICMProfileW failed %u\n", GetLastError()); SetLastError( 0xdeadbeef ); ret = SetICMProfileW( NULL, NULL ); error = GetLastError(); ok(!ret, "SetICMProfileW succeeded\n"); ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error); SetLastError( 0xdeadbeef ); ret = SetICMProfileW( NULL, profile ); error = GetLastError(); ok(!ret, "SetICMProfileW succeeded\n"); ok(error == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %u\n", error); SetLastError( 0xdeadbeef ); ret = SetICMProfileW( dc, NULL ); error = GetLastError(); ok(!ret, "SetICMProfileW succeeded\n"); ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error); ret = SetICMProfileW( dc, profile ); ok(ret, "SetICMProfileW failed %u\n", GetLastError()); }