|
| 1 | +/* |
| 2 | + * PROJECT: ReactOS api tests |
| 3 | + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) |
| 4 | + * PURPOSE: Tests for MapWin32ErrorToSTG |
| 5 | + * COPYRIGHT: Copyright 2026 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> |
| 6 | + */ |
| 7 | + |
| 8 | +#include <apitest.h> |
| 9 | +#include <shlwapi.h> |
| 10 | + |
| 11 | +typedef HRESULT (WINAPI *FN_MapWin32ErrorToSTG)(HRESULT); |
| 12 | +static FN_MapWin32ErrorToSTG s_fnMapWin32ErrorToSTG = NULL; |
| 13 | + |
| 14 | +START_TEST(MapWin32ErrorToSTG) |
| 15 | +{ |
| 16 | + HRESULT hr; |
| 17 | + HINSTANCE hSHLWAPI; |
| 18 | + |
| 19 | + hSHLWAPI = GetModuleHandleA("shlwapi"); |
| 20 | + s_fnMapWin32ErrorToSTG = (FN_MapWin32ErrorToSTG) |
| 21 | + GetProcAddress(hSHLWAPI, MAKEINTRESOURCEA(485)); |
| 22 | + if (!s_fnMapWin32ErrorToSTG) |
| 23 | + { |
| 24 | + skip("MapWin32ErrorToSTG not found\n"); |
| 25 | + return; |
| 26 | + } |
| 27 | + |
| 28 | + hr = s_fnMapWin32ErrorToSTG(HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED)); |
| 29 | + ok_long(hr, STG_E_ACCESSDENIED); |
| 30 | + |
| 31 | + hr = s_fnMapWin32ErrorToSTG(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)); |
| 32 | + ok_long(hr, STG_E_FILENOTFOUND); |
| 33 | + |
| 34 | + hr = s_fnMapWin32ErrorToSTG(HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)); |
| 35 | + ok_long(hr, STG_E_FILENOTFOUND); |
| 36 | + |
| 37 | + hr = s_fnMapWin32ErrorToSTG(HRESULT_FROM_WIN32(ERROR_FILE_EXISTS)); |
| 38 | + ok_long(hr, STG_E_FILEALREADYEXISTS); |
| 39 | + |
| 40 | + hr = s_fnMapWin32ErrorToSTG(HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)); |
| 41 | + ok_long(hr, STG_E_FILEALREADYEXISTS); |
| 42 | + |
| 43 | + hr = s_fnMapWin32ErrorToSTG(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); |
| 44 | + ok_long(hr, HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); |
| 45 | +} |
0 commit comments