mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[SHLWAPI][SHLWAPI_APITEST][SDK] Support MapWin32ErrorToSTG (#9147)
Implementing missing features... JIRA issue: CORE-19278 - Implement MapWin32ErrorToSTG function. - Modify shlwapi.spec. - Add prototype to <shlwapi_undoc.h>. - Add MapWin32ErrorToSTG testcase.
This commit is contained in:
@@ -482,7 +482,7 @@
|
||||
482 stub -noname SHMessageBoxHelpA
|
||||
483 stub -noname SHMessageBoxHelpW
|
||||
484 stdcall -noname IUnknown_QueryServiceExec(ptr ptr ptr long long long ptr)
|
||||
485 stub -noname MapWin32ErrorToSTG
|
||||
485 stdcall -noname MapWin32ErrorToSTG(long)
|
||||
486 stub -noname ModeToCreateFileFlags
|
||||
487 stdcall -ordinal SHLoadIndirectString(wstr ptr long ptr)
|
||||
488 stub -noname SHConvertGraphicsFile
|
||||
|
||||
@@ -219,6 +219,29 @@ PathUnExpandEnvStringsForUserW(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* MapWin32ErrorToSTG [SHLWAPI.485]
|
||||
*
|
||||
* https://undoc.airesoft.co.uk/shlwapi.dll/MapWin32ErrorToSTG.php
|
||||
*/
|
||||
EXTERN_C HRESULT WINAPI
|
||||
MapWin32ErrorToSTG(_In_ HRESULT hr)
|
||||
{
|
||||
switch (hr)
|
||||
{
|
||||
case HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED):
|
||||
return STG_E_ACCESSDENIED;
|
||||
case HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND):
|
||||
case HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND):
|
||||
return STG_E_FILENOTFOUND;
|
||||
case HRESULT_FROM_WIN32(ERROR_FILE_EXISTS):
|
||||
case HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS):
|
||||
return STG_E_FILEALREADYEXISTS;
|
||||
default:
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL CharLowerNoDBCSAWorker(PSTR lpString, INT cchMax, BOOL bUppercase)
|
||||
{
|
||||
CHAR szBuff[MAX_PATH];
|
||||
|
||||
@@ -11,6 +11,7 @@ list(APPEND SOURCE
|
||||
IShellFolderHelpers.cpp
|
||||
IsQSForward.cpp
|
||||
IStreamPidl.cpp
|
||||
MapWin32ErrorToSTG.c
|
||||
NextPath.c
|
||||
PathFileExistsDefExtAndAttributesW.c
|
||||
PathFindOnPath.c
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
* PURPOSE: Tests for MapWin32ErrorToSTG
|
||||
* COPYRIGHT: Copyright 2026 Katayama Hirofumi MZ <[email protected]>
|
||||
*/
|
||||
|
||||
#include <apitest.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
typedef HRESULT (WINAPI *FN_MapWin32ErrorToSTG)(HRESULT);
|
||||
static FN_MapWin32ErrorToSTG s_fnMapWin32ErrorToSTG = NULL;
|
||||
|
||||
START_TEST(MapWin32ErrorToSTG)
|
||||
{
|
||||
HRESULT hr;
|
||||
HINSTANCE hSHLWAPI;
|
||||
|
||||
hSHLWAPI = GetModuleHandleA("shlwapi");
|
||||
s_fnMapWin32ErrorToSTG = (FN_MapWin32ErrorToSTG)
|
||||
GetProcAddress(hSHLWAPI, MAKEINTRESOURCEA(485));
|
||||
if (!s_fnMapWin32ErrorToSTG)
|
||||
{
|
||||
skip("MapWin32ErrorToSTG not found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hr = s_fnMapWin32ErrorToSTG(HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED));
|
||||
ok_long(hr, STG_E_ACCESSDENIED);
|
||||
|
||||
hr = s_fnMapWin32ErrorToSTG(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
|
||||
ok_long(hr, STG_E_FILENOTFOUND);
|
||||
|
||||
hr = s_fnMapWin32ErrorToSTG(HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND));
|
||||
ok_long(hr, STG_E_FILENOTFOUND);
|
||||
|
||||
hr = s_fnMapWin32ErrorToSTG(HRESULT_FROM_WIN32(ERROR_FILE_EXISTS));
|
||||
ok_long(hr, STG_E_FILEALREADYEXISTS);
|
||||
|
||||
hr = s_fnMapWin32ErrorToSTG(HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS));
|
||||
ok_long(hr, STG_E_FILEALREADYEXISTS);
|
||||
|
||||
hr = s_fnMapWin32ErrorToSTG(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER));
|
||||
ok_long(hr, HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER));
|
||||
}
|
||||
@@ -9,6 +9,7 @@ extern void func_PathFindOnPath(void);
|
||||
extern void func_IShellFolderHelpers(void);
|
||||
extern void func_IsQSForward(void);
|
||||
extern void func_IStreamPidl(void);
|
||||
extern void func_MapWin32ErrorToSTG(void);
|
||||
extern void func_NextPath(void);
|
||||
extern void func_PathIsUNC(void);
|
||||
extern void func_PathIsUNCServer(void);
|
||||
@@ -37,6 +38,7 @@ const struct test winetest_testlist[] =
|
||||
{ "IShellFolderHelpers", func_IShellFolderHelpers },
|
||||
{ "IsQSForward", func_IsQSForward },
|
||||
{ "IStreamPidl", func_IStreamPidl },
|
||||
{ "MapWin32ErrorToSTG", func_MapWin32ErrorToSTG },
|
||||
{ "NextPath", func_NextPath },
|
||||
{ "PathIsUNC", func_PathIsUNC },
|
||||
{ "PathIsUNCServer", func_PathIsUNCServer },
|
||||
|
||||
@@ -513,6 +513,8 @@ SHDialogBox(
|
||||
_In_opt_ SHDIALOGPROC fn,
|
||||
_In_opt_ PVOID pThis);
|
||||
|
||||
HRESULT WINAPI MapWin32ErrorToSTG(_In_ HRESULT hr);
|
||||
|
||||
PSTR WINAPI CharLowerNoDBCSA(_Inout_ PSTR lpString);
|
||||
PWSTR WINAPI CharLowerNoDBCSW(_Inout_ PWSTR lpString);
|
||||
PSTR WINAPI CharUpperNoDBCSA(_Inout_ PSTR lpString);
|
||||
|
||||
Reference in New Issue
Block a user