From 370a6f8dc3ddf63874d84aa0d8b27d45fba7cd70 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 3 Nov 2014 14:36:57 +0000 Subject: [PATCH] [SHELL32] * Move control.cpp to the wine folder. * Rename control.cpp to control.c. * Partially sync control.c with Wine 1.7.27. CORE-8540 svn path=/branches/shell-experiments/; revision=65224 --- dll/win32/shell32/CMakeLists.txt | 2 +- dll/win32/shell32/cpanel.h | 4 +- .../shell32/{control.cpp => wine/control.c} | 44 ++++++++++++------- 3 files changed, 31 insertions(+), 19 deletions(-) rename dll/win32/shell32/{control.cpp => wine/control.c} (95%) diff --git a/dll/win32/shell32/CMakeLists.txt b/dll/win32/shell32/CMakeLists.txt index 76300a4345b..ab6a5090e15 100644 --- a/dll/win32/shell32/CMakeLists.txt +++ b/dll/win32/shell32/CMakeLists.txt @@ -22,7 +22,6 @@ list(APPEND SOURCE changenotify.cpp classes.cpp clipboard.cpp - control.cpp CMenuBand.cpp CMenuDeskBar.cpp dataobject.cpp @@ -73,6 +72,7 @@ list(APPEND SOURCE add_library(shell32 SHARED ${SOURCE} + wine/control.c wine/shell32_main.c wine/shellole.c wine/shellpath.c diff --git a/dll/win32/shell32/cpanel.h b/dll/win32/shell32/cpanel.h index 3685cd95b04..2cf0a8293f4 100644 --- a/dll/win32/shell32/cpanel.h +++ b/dll/win32/shell32/cpanel.h @@ -43,7 +43,7 @@ typedef struct CPanel } CPanel; -CPlApplet *Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel); -CPlApplet *Control_UnloadApplet(CPlApplet* applet); +EXTERN_C CPlApplet *Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel); +EXTERN_C CPlApplet *Control_UnloadApplet(CPlApplet* applet); #endif /* __WINE_SHELL_CPANEL_H */ diff --git a/dll/win32/shell32/control.cpp b/dll/win32/shell32/wine/control.c similarity index 95% rename from dll/win32/shell32/control.cpp rename to dll/win32/shell32/wine/control.c index 855c1f86f4d..ced32127593 100644 --- a/dll/win32/shell32/control.cpp +++ b/dll/win32/shell32/wine/control.c @@ -1,6 +1,7 @@ /* Control Panel management * * Copyright 2001 Eric Pouech + * Copyright 2008 Owen Rudge * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,7 +18,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include + +#define WIN32_NO_STATUS +#define _INC_WINDOWS + +#include +#include +#define NO_SHLWAPI_REG +#include +#include + +#include "cpanel.h" WINE_DEFAULT_DEBUG_CHANNEL(shlctrl); @@ -349,12 +361,14 @@ static void Control_DoWindow(CPanel *panel, HWND hWnd, HINSTANCE hInst) static void Control_DoLaunch(CPanel *pPanel, HWND hWnd, LPCWSTR pwszCmd) { + HANDLE hMutex; + /* Make a pwszCmd copy so we can modify it */ LPWSTR pwszCmdCopy = _wcsdup(pwszCmd); - if (!pwszCmdCopy) - return; LPWSTR pwszPath = pwszCmdCopy, pwszArg = NULL, pwszArg2 = NULL; + if (!pwszCmdCopy) + return; /* Path can be quoted */ if (pwszPath[0] == L'"') @@ -391,7 +405,7 @@ static void Control_DoLaunch(CPanel *pPanel, HWND hWnd, LPCWSTR pwszCmd) TRACE("Launch %ls, arg %ls, arg2 %ls\n", pwszPath, pwszArg, pwszArg2); /* Create a mutex to disallow running multiple instances */ - HANDLE hMutex = CreateMutexW(NULL, TRUE, PathFindFileNameW(pwszPath)); + hMutex = CreateMutexW(NULL, TRUE, PathFindFileNameW(pwszPath)); if (!hMutex || GetLastError() == ERROR_ALREADY_EXISTS) { TRACE("Next instance disallowed\n"); @@ -405,13 +419,13 @@ static void Control_DoLaunch(CPanel *pPanel, HWND hWnd, LPCWSTR pwszCmd) Control_LoadApplet(hWnd, pwszPath, pPanel); if (pPanel->first) { + INT i = 0; /* First pPanel applet is the new one */ CPlApplet *pApplet = pPanel->first; assert(pApplet && pApplet->next == NULL); TRACE("pApplet->count %d\n", pApplet->count); /* Note: if there is only one applet, first argument is ignored */ - INT i = 0; if (pApplet->count > 1 && pwszArg && pwszArg[0]) { /* If arg begins with '@', number specifies applet index */ @@ -454,7 +468,7 @@ EXTERN_C void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DW CPanel Panel; TRACE("(%p, %p, %s, 0x%08x)\n", - hWnd, hInst, debugstr_w(cmd), nCmdShow); + hWnd, hInst, debugstr_w(cmd), nCmdShow); memset(&Panel, 0, sizeof(Panel)); @@ -471,37 +485,35 @@ EXTERN_C void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DW } /************************************************************************* - * Control_RunDLLA [SHELL32.@] + * Control_RunDLLA [SHELL32.@] * */ -EXTERN_C void WINAPI Control_RunDLLA(HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow) +void WINAPI Control_RunDLLA(HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow) { DWORD len = MultiByteToWideChar(CP_ACP, 0, cmd, -1, NULL, 0 ); - LPWSTR wszCmd = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - + LPWSTR wszCmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (wszCmd && MultiByteToWideChar(CP_ACP, 0, cmd, -1, wszCmd, len )) { Control_RunDLLW(hWnd, hInst, wszCmd, nCmdShow); } - HeapFree(GetProcessHeap(), 0, wszCmd); } /************************************************************************* - * Control_FillCache_RunDLLW [SHELL32.@] + * Control_FillCache_RunDLLW [SHELL32.@] * */ -EXTERN_C HRESULT WINAPI Control_FillCache_RunDLLW(HWND hWnd, HANDLE hModule, DWORD w, DWORD x) +HRESULT WINAPI Control_FillCache_RunDLLW(HWND hWnd, HANDLE hModule, DWORD w, DWORD x) { FIXME("%p %p 0x%08x 0x%08x stub\n", hWnd, hModule, w, x); - return 0; + return S_OK; } /************************************************************************* - * Control_FillCache_RunDLLA [SHELL32.@] + * Control_FillCache_RunDLLA [SHELL32.@] * */ -EXTERN_C HRESULT WINAPI Control_FillCache_RunDLLA(HWND hWnd, HANDLE hModule, DWORD w, DWORD x) +HRESULT WINAPI Control_FillCache_RunDLLA(HWND hWnd, HANDLE hModule, DWORD w, DWORD x) { return Control_FillCache_RunDLLW(hWnd, hModule, w, x); }