2018-11-16 11:24:03 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Shell
|
|
|
|
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
|
|
|
|
* PURPOSE: ReactOS Networking Configuration
|
|
|
|
* COPYRIGHT: Copyright 2008 Johannes Anderwald (johannes.anderwald@reactos.org)
|
|
|
|
*/
|
|
|
|
|
2008-08-27 17:18:25 +00:00
|
|
|
#include "precomp.h"
|
|
|
|
|
2018-11-12 11:23:38 +00:00
|
|
|
HMODULE g_hModule = NULL;
|
2014-01-25 10:59:27 +00:00
|
|
|
|
2008-08-27 17:18:25 +00:00
|
|
|
HINSTANCE netshell_hInstance;
|
2008-08-29 14:18:55 +00:00
|
|
|
|
2018-11-12 11:23:38 +00:00
|
|
|
class CNetshellModule : public CComModule
|
2008-08-27 17:18:25 +00:00
|
|
|
{
|
2018-11-12 11:23:38 +00:00
|
|
|
public:
|
|
|
|
};
|
|
|
|
|
|
|
|
BEGIN_OBJECT_MAP(ObjectMap)
|
|
|
|
OBJECT_ENTRY(CLSID_ConnectionFolder, CNetworkConnections)
|
|
|
|
OBJECT_ENTRY(CLSID_ConnectionManager, CNetConnectionManager)
|
|
|
|
OBJECT_ENTRY(CLSID_LanConnectionUi, CNetConnectionPropertyUi)
|
|
|
|
OBJECT_ENTRY(CLSID_ConnectionTray, CLanStatus)
|
|
|
|
END_OBJECT_MAP()
|
|
|
|
|
|
|
|
CNetshellModule gModule;
|
2008-08-27 17:18:25 +00:00
|
|
|
|
2018-11-12 11:23:38 +00:00
|
|
|
HPROPSHEETPAGE
|
|
|
|
InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
|
|
|
|
{
|
|
|
|
PROPSHEETPAGEW ppage;
|
|
|
|
|
|
|
|
memset(&ppage, 0x0, sizeof(PROPSHEETPAGEW));
|
|
|
|
ppage.dwSize = sizeof(PROPSHEETPAGEW);
|
|
|
|
ppage.dwFlags = PSP_DEFAULT;
|
|
|
|
ppage.pszTemplate = resname;
|
|
|
|
ppage.pfnDlgProc = dlgproc;
|
|
|
|
ppage.lParam = lParam;
|
|
|
|
ppage.hInstance = netshell_hInstance;
|
|
|
|
if (szTitle)
|
|
|
|
{
|
|
|
|
ppage.dwFlags |= PSP_USETITLE;
|
|
|
|
ppage.pszTitle = szTitle;
|
|
|
|
}
|
|
|
|
return CreatePropertySheetPageW(&ppage);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
2015-02-28 10:11:51 +00:00
|
|
|
|
2008-08-27 17:18:25 +00:00
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
|
|
|
{
|
|
|
|
switch (fdwReason)
|
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
netshell_hInstance = hinstDLL;
|
|
|
|
DisableThreadLibraryCalls(netshell_hInstance);
|
2018-11-12 11:23:38 +00:00
|
|
|
gModule.Init(ObjectMap, netshell_hInstance, NULL);
|
2008-08-27 17:18:25 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT
|
|
|
|
WINAPI
|
|
|
|
DllCanUnloadNow(void)
|
|
|
|
{
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
STDAPI
|
|
|
|
DllRegisterServer(void)
|
|
|
|
{
|
2018-11-12 11:23:38 +00:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = gModule.DllRegisterServer(FALSE);
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
hr = gModule.UpdateRegistryFromResource(IDR_NETSHELL, TRUE, NULL);
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
return S_OK;
|
2008-08-27 17:18:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
STDAPI
|
|
|
|
DllUnregisterServer(void)
|
|
|
|
{
|
2018-11-12 11:23:38 +00:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = gModule.DllUnregisterServer(FALSE);
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
hr = gModule.UpdateRegistryFromResource(IDR_NETSHELL, FALSE, NULL);
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
return S_OK;
|
2008-08-27 17:18:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
STDAPI
|
|
|
|
DllGetClassObject(
|
|
|
|
REFCLSID rclsid,
|
|
|
|
REFIID riid,
|
2012-01-20 21:50:54 +00:00
|
|
|
LPVOID *ppv)
|
2008-08-27 17:18:25 +00:00
|
|
|
{
|
2018-11-12 11:23:38 +00:00
|
|
|
return gModule.DllGetClassObject(rclsid, riid, ppv);
|
2008-08-27 17:18:25 +00:00
|
|
|
}
|
2008-08-29 14:18:55 +00:00
|
|
|
|
|
|
|
VOID
|
2008-11-30 11:42:05 +00:00
|
|
|
WINAPI
|
2012-01-20 21:50:54 +00:00
|
|
|
NcFreeNetconProperties(NETCON_PROPERTIES *pProps)
|
2008-08-29 14:18:55 +00:00
|
|
|
{
|
|
|
|
CoTaskMemFree(pProps->pszwName);
|
|
|
|
CoTaskMemFree(pProps->pszwDeviceName);
|
|
|
|
CoTaskMemFree(pProps);
|
|
|
|
}
|
2012-01-20 21:50:54 +00:00
|
|
|
|
2016-11-30 20:31:50 +00:00
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
NcIsValidConnectionName(_In_ PCWSTR pszwName)
|
|
|
|
{
|
|
|
|
if (!pszwName)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
BOOL nonSpace = FALSE;
|
|
|
|
while (*pszwName)
|
|
|
|
{
|
|
|
|
switch(*(pszwName++))
|
|
|
|
{
|
|
|
|
case L'\\':
|
|
|
|
case L'/':
|
|
|
|
case L':':
|
|
|
|
case L'*':
|
|
|
|
case L'\t':
|
|
|
|
case L'?':
|
|
|
|
case L'<':
|
|
|
|
case L'>':
|
|
|
|
case L'|':
|
|
|
|
case L'\"':
|
|
|
|
return FALSE;
|
|
|
|
case L' ':
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
nonSpace = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nonSpace;
|
|
|
|
}
|
|
|
|
|
2012-01-20 21:50:54 +00:00
|
|
|
} // extern "C"
|