https://git.reactos.org/?p=reactos.git;a=commitdiff;h=128e7f5aeab55912b3581…
commit 128e7f5aeab55912b35814597fcde32c978951dc
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Oct 28 22:29:05 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Oct 28 22:29:05 2023 +0900
[SHELL32][SDK] Implement SHStartNetConnectionDialogA (#5847)
and add SHStartNetConnectionDialog prototype to <shlobj.h>.
---
dll/win32/shell32/stubs.cpp | 20 ++++----------------
dll/win32/shell32/utils.cpp | 26 ++++++++++++++++++++++++++
dll/win32/shell32/wine/shellord.c | 6 ++++++
sdk/include/psdk/shlobj.h | 12 ++++++++++++
4 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/dll/win32/shell32/stubs.cpp b/dll/win32/shell32/stubs.cpp
index bae11321006..b1e153fdb67 100644
--- a/dll/win32/shell32/stubs.cpp
+++ b/dll/win32/shell32/stubs.cpp
@@ -712,22 +712,10 @@ PifMgr_SetProperties(HANDLE hHandle, LPCSTR lpName, LPCVOID
lpUnknown, INT iUnkn
*/
EXTERN_C HRESULT
WINAPI
-SHStartNetConnectionDialogA(HWND hwnd,
- LPCSTR pszRemoteName,
- DWORD dwType)
-{
- FIXME("SHStartNetConnectionDialogA() stub\n");
- return E_FAIL;
-}
-
-/*
- * Unimplemented
- */
-EXTERN_C HRESULT
-WINAPI
-SHStartNetConnectionDialogW(HWND hwnd,
- LPCWSTR pszRemoteName,
- DWORD dwType)
+SHStartNetConnectionDialogW(
+ _In_ HWND hwnd,
+ _In_ LPCWSTR pszRemoteName,
+ _In_ DWORD dwType)
{
FIXME("SHStartNetConnectionDialogW() stub\n");
return E_FAIL;
diff --git a/dll/win32/shell32/utils.cpp b/dll/win32/shell32/utils.cpp
index 94b25e49bde..697a4f59cea 100644
--- a/dll/win32/shell32/utils.cpp
+++ b/dll/win32/shell32/utils.cpp
@@ -604,3 +604,29 @@ Activate_RunDLL(
GetWindowThreadProcessId(GetShellWindow(), &dwProcessID);
return AllowSetForegroundWindow(dwProcessID);
}
+
+/*************************************************************************
+ * SHStartNetConnectionDialogA (SHELL32.12)
+ *
+ * @see
https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_c…
+ */
+EXTERN_C
+HRESULT WINAPI
+SHStartNetConnectionDialogA(
+ _In_ HWND hwnd,
+ _In_ LPCSTR pszRemoteName,
+ _In_ DWORD dwType)
+{
+ LPCWSTR pszRemoteNameW = NULL;
+ CStringW strRemoteNameW;
+
+ TRACE("(%p, %s, %lu)\n", hwnd, debugstr_a(pszRemoteName), dwType);
+
+ if (pszRemoteName)
+ {
+ strRemoteNameW = pszRemoteName;
+ pszRemoteNameW = strRemoteNameW;
+ }
+
+ return SHStartNetConnectionDialogW(hwnd, pszRemoteNameW, dwType);
+}
diff --git a/dll/win32/shell32/wine/shellord.c b/dll/win32/shell32/wine/shellord.c
index 43c3775c0e8..51cbd9e8218 100644
--- a/dll/win32/shell32/wine/shellord.c
+++ b/dll/win32/shell32/wine/shellord.c
@@ -2348,9 +2348,15 @@ BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir,
LPWSTR pszName,
HRESULT WINAPI SHStartNetConnectionDialog(HWND hwnd, LPCSTR pszRemoteName, DWORD dwType)
{
+#ifdef __REACTOS__
+ if (SHELL_OsIsUnicode())
+ return SHStartNetConnectionDialogW(hwnd, (LPCWSTR)pszRemoteName, dwType);
+ return SHStartNetConnectionDialogA(hwnd, pszRemoteName, dwType);
+#else
FIXME("%p, %s, 0x%08x - stub\n", hwnd, debugstr_a(pszRemoteName), dwType);
return S_OK;
+#endif
}
/*************************************************************************
* SHSetLocalizedName (SHELL32.@)
diff --git a/sdk/include/psdk/shlobj.h b/sdk/include/psdk/shlobj.h
index a9c90ffc137..629d9f4a827 100644
--- a/sdk/include/psdk/shlobj.h
+++ b/sdk/include/psdk/shlobj.h
@@ -390,6 +390,18 @@ SHOpenPropSheetW(
#define SHOpenPropSheet WINELIB_NAME_AW(SHOpenPropSheet)
+HRESULT WINAPI
+SHStartNetConnectionDialogA(
+ _In_ HWND hwnd,
+ _In_ LPCSTR pszRemoteName,
+ _In_ DWORD dwType);
+
+HRESULT WINAPI
+SHStartNetConnectionDialogW(
+ _In_ HWND hwnd,
+ _In_ LPCWSTR pszRemoteName,
+ _In_ DWORD dwType);
+
/*****************************************************************************
* IContextMenu interface
*/