From 7d8e2f768d10fbf9e82c8748e34380eec0dce366 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 20 Jun 2015 08:34:46 +0000 Subject: unified project for ShellExt git-svn-id: http://svn.miranda-ng.org/main/trunk@14281 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ShellExt/src/main.cpp | 4 ++-- plugins/ShellExt/src/shlcom.cpp | 9 ++++----- plugins/ShellExt/src/shlcom.h | 7 +++---- plugins/ShellExt/src/shlext.cpp | 15 +++++++-------- plugins/ShellExt/src/shlipc.cpp | 2 +- plugins/ShellExt/src/stdafx.cpp | 18 ------------------ plugins/ShellExt/src/stdafx.cxx | 18 ++++++++++++++++++ plugins/ShellExt/src/stdafx.h | 1 - 8 files changed, 35 insertions(+), 39 deletions(-) delete mode 100644 plugins/ShellExt/src/stdafx.cpp create mode 100644 plugins/ShellExt/src/stdafx.cxx (limited to 'plugins/ShellExt/src') diff --git a/plugins/ShellExt/src/main.cpp b/plugins/ShellExt/src/main.cpp index 10e018ae3e..c71028a40d 100644 --- a/plugins/ShellExt/src/main.cpp +++ b/plugins/ShellExt/src/main.cpp @@ -21,7 +21,7 @@ PLUGININFOEX pluginInfoEx = { {0x7993ab24, 0x1fda, 0x428c, {0xa8, 0x9b, 0xbe, 0x37, 0x7a, 0x10, 0xbe, 0x3a}} }; -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID) { if (fdwReason == DLL_PROCESS_ATTACH) { bIsVistaPlus = GetProcAddress( GetModuleHandleA("kernel32.dll"), "GetProductInfo") != NULL; @@ -36,7 +36,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfoEx; } diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index fe15398aee..0ace778b30 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -235,7 +235,6 @@ void ipcGetSkinIcons(THeaderIPC *ipch) bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) { - bool Result = false; // hide offliners? bool bHideOffline = db_get_b(0, "CList", "HideOffline", 0) == 1; // do they wanna hide the offline people anyway? @@ -356,10 +355,9 @@ void __cdecl ClearMRUThread(void*) } // this function is called from an APC into the main thread -void __stdcall ipcService(ULONG_PTR dwParam) +void __stdcall ipcService(ULONG_PTR) { HANDLE hSignal; - TSlotIPC *pct; LPSTR szBuf; char szGroupStr[32]; DBVARIANT dbv; @@ -384,7 +382,7 @@ void __stdcall ipcService(ULONG_PTR dwParam) pMMT->pServerBaseAddress = pMMT->pClientBaseAddress; pMMT->pClientBaseAddress = cloned; memcpy(cloned, pMMT, IPC_PACKET_SIZE); - ipcFixupAddresses(true, cloned); + ipcFixupAddresses(cloned); DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &cloned->Param, THREAD_SET_CONTEXT, false, 0); mir_forkthread(&IssueTransferThread, cloned); goto Reply; @@ -402,7 +400,7 @@ void __stdcall ipcService(ULONG_PTR dwParam) pMMT->pServerBaseAddress = pMMT->pClientBaseAddress; pMMT->pClientBaseAddress = pMMT; // translate to the server space map - ipcFixupAddresses(true, pMMT); + ipcFixupAddresses(pMMT); // store the address map offset so the caller can retranslate pMMT->pServerBaseAddress = pMMT; // return some options to the client @@ -426,6 +424,7 @@ void __stdcall ipcService(ULONG_PTR dwParam) if (bGroupMode && BST_CHECKED == db_get_b(0, SHLExt_Name, SHLExt_UseCListSetting, BST_UNCHECKED)) bGroupMode = db_get_b(0, "CList", "UseGroups", true) != 0; + TSlotIPC *pct = NULL; int iSlot = 0; // return profile if set if (BST_UNCHECKED == db_get_b(0, SHLExt_Name, SHLExt_ShowNoProfile, BST_UNCHECKED)) { diff --git a/plugins/ShellExt/src/shlcom.h b/plugins/ShellExt/src/shlcom.h index c5adf538a2..1fc9b44f1e 100644 --- a/plugins/ShellExt/src/shlcom.h +++ b/plugins/ShellExt/src/shlcom.h @@ -198,14 +198,13 @@ typedef int TSlotDrawTypes; typedef int (__stdcall TMenuCommandCallback)( THeaderIPC *pipch, // IPC header info, already mapped HANDLE hWorkThreadEvent, // event object being waited on on miranda thread - HANDLE hAckEvent, // ack event object that has been created - struct TMenuDrawInfo *psd); // command/draw info + HANDLE hAckEvent); // ack event object that has been created struct TMenuDrawInfo { char *szText, *szProfile; int cch; - int wID; // should be the same as the menu item's ID + UINT wID; TSlotDrawTypes fTypes; MCONTACT hContact; HICON hStatusIcon; // HICON from Self->ProtoIcons[index].hIcons[status]; Do not DestroyIcon() @@ -219,7 +218,7 @@ struct TMenuDrawInfo void ipcPrepareRequests(int ipcPacketSize, THeaderIPC *pipch, DWORD fRequests); DWORD ipcSendRequest(HANDLE hSignal, HANDLE hWaitFor, THeaderIPC *pipch, DWORD dwTimeoutMsecs); TSlotIPC* ipcAlloc(THeaderIPC *pipch, int nSize); -void ipcFixupAddresses(BOOL FromServer, THeaderIPC *pipch); +void ipcFixupAddresses(THeaderIPC *pipch); TGroupNode* AllocGroupNode(TGroupNodeList *list, TGroupNode *Root, int Depth); TGroupNode* FindGroupNode(TGroupNode* p, const DWORD Hash, int Depth); diff --git a/plugins/ShellExt/src/shlext.cpp b/plugins/ShellExt/src/shlext.cpp index 977232ba19..780d7f86e3 100644 --- a/plugins/ShellExt/src/shlext.cpp +++ b/plugins/ShellExt/src/shlext.cpp @@ -110,7 +110,7 @@ ULONG TShellExt::Release() return ret; } -HRESULT TShellExt::Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) +HRESULT TShellExt::Initialize(PCIDLIST_ABSOLUTE, IDataObject *pdtobj, HKEY) { // DObj is a pointer to an instance of IDataObject which is a pointer itself // it contains a pointer to a function table containing the function pointer @@ -129,7 +129,7 @@ HRESULT TShellExt::Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, return S_OK; } -HRESULT TShellExt::GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pReserved, LPSTR pszName, UINT cchMax) +HRESULT TShellExt::GetCommandString(UINT_PTR, UINT, UINT*, LPSTR, UINT) { return E_NOTIMPL; } @@ -226,8 +226,7 @@ void DecideMenuItemInfo(TSlotIPC *pct, TGroupNode *pg, MENUITEMINFOA &mii, TEnum int __stdcall ClearMRUIPC( THeaderIPC *pipch, // IPC header info, already mapped HANDLE hWorkThreadEvent, // event object being waited on on miranda thread - HANDLE hAckEvent, // ack event object that has been created - TMenuDrawInfo *psd) // command/draw info + HANDLE hAckEvent) // ack event object that has been created { ipcPrepareRequests(IPC_PACKET_SIZE, pipch, REQUEST_CLEARMRU); ipcSendRequest(hWorkThreadEvent, hAckEvent, pipch, 100); @@ -276,7 +275,7 @@ void BuildContactTree(TGroupNode *group, TEnumData *lParam) char *sz = strtok(LPSTR(UINT_PTR(pct) + sizeof(TSlotIPC) + UINT_PTR(pct->cbStrSection) + 1), "\\"); // restore the root TGroupNode *pg = group; - unsigned Depth = 0; + int Depth = 0; while (sz != NULL) { UINT Hash = murmur_hash(sz); // find this node within @@ -605,7 +604,7 @@ BOOL __stdcall ProcessRequest(HWND hwnd, LPARAM param) lParam->ipch->pClientBaseAddress = lParam->ipch; // fixup all the pointers to be relative to the memory map // the base pointer of the client side version of the mapped file - ipcFixupAddresses(false, lParam->ipch); + ipcFixupAddresses(lParam->ipch); // store the PID used to create the work event object // that got replied to -- this is needed since each contact // on the final menu maybe on a different instance and another OpenEvent() will be needed. @@ -653,7 +652,7 @@ HRESULT TShellExt::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT _idCmdFirs HANDLE hMap = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, IPC_PACKET_SIZE, IPC_PACKET_NAME); if (hMap != 0 && GetLastError() != ERROR_ALREADY_EXISTS) { - TEnumData ed; + TEnumData ed = { 0 }; // map the memory to this address space THeaderIPC *pipch = (THeaderIPC*)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0); if (pipch != NULL) { @@ -771,7 +770,7 @@ HRESULT RequestTransfer(TShellExt *Self, int idxCmd) if (hReply != 0) { if (psd->fTypes & dtCommand) { if (psd->MenuCommandCallback) - hr = psd->MenuCommandCallback(pipch, hTransfer, hReply, psd); + hr = psd->MenuCommandCallback(pipch, hTransfer, hReply); } else { // prepare the buffer diff --git a/plugins/ShellExt/src/shlipc.cpp b/plugins/ShellExt/src/shlipc.cpp index eda0729a7a..41a195af77 100644 --- a/plugins/ShellExt/src/shlipc.cpp +++ b/plugins/ShellExt/src/shlipc.cpp @@ -107,7 +107,7 @@ TSlotIPC* ipcAlloc(THeaderIPC *pipch, int nSize) return p; } -void ipcFixupAddresses(BOOL FromServer, THeaderIPC *pipch) +void ipcFixupAddresses(THeaderIPC *pipch) { if (pipch->pServerBaseAddress == pipch->pClientBaseAddress) return; diff --git a/plugins/ShellExt/src/stdafx.cpp b/plugins/ShellExt/src/stdafx.cpp deleted file mode 100644 index 6fb37564b7..0000000000 --- a/plugins/ShellExt/src/stdafx.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "stdafx.h" \ No newline at end of file diff --git a/plugins/ShellExt/src/stdafx.cxx b/plugins/ShellExt/src/stdafx.cxx new file mode 100644 index 0000000000..6fb37564b7 --- /dev/null +++ b/plugins/ShellExt/src/stdafx.cxx @@ -0,0 +1,18 @@ +/* +Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation version 2 +of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include "stdafx.h" \ No newline at end of file diff --git a/plugins/ShellExt/src/stdafx.h b/plugins/ShellExt/src/stdafx.h index 83fc655a65..743de5fee4 100644 --- a/plugins/ShellExt/src/stdafx.h +++ b/plugins/ShellExt/src/stdafx.h @@ -1,4 +1,3 @@ -#define _CRT_SECURE_NO_WARNINGS #include #include -- cgit v1.2.3