summaryrefslogtreecommitdiff
path: root/plugins/ShellExt
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-08-24 09:38:52 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-08-24 09:38:52 +0000
commit93a760ea142af7c9f318b5ad2b6a7677fbfda40c (patch)
treeb9cb59223781eb7981165e2e5ddda3f930378aaa /plugins/ShellExt
parent891b4a4149891fac17061972ac96eb4269cf77b9 (diff)
eliminating usage of std::string
git-svn-id: http://svn.miranda-ng.org/main/trunk@5809 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ShellExt')
-rw-r--r--plugins/ShellExt/src/shlcom.cpp22
-rw-r--r--plugins/ShellExt/src/stdafx.h3
2 files changed, 11 insertions, 14 deletions
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp
index d4efcd09c6..b2de97009b 100644
--- a/plugins/ShellExt/src/shlcom.cpp
+++ b/plugins/ShellExt/src/shlcom.cpp
@@ -57,17 +57,15 @@ int IsCOMRegistered()
/////////////////////////////////////////////////////////////////////////////////////////
-static string CreateProcessUID(int pid)
+static char* CreateProcessUID(int pid, char *buf, size_t bufLen)
{
- char buf[100];
- sprintf_s(buf, sizeof(buf), "mim.shlext.%d$", pid);
+ sprintf_s(buf, bufLen, "mim.shlext.%d$", pid);
return buf;
}
-static string CreateUID()
+static char* CreateUID(char *buf, size_t bufLen)
{
- char buf[100];
- sprintf_s(buf, sizeof(buf), "'mim.shlext.caller%d$%d", GetCurrentProcessId(), GetCurrentThreadId());
+ sprintf_s(buf, bufLen, "'mim.shlext.caller%d$%d", GetCurrentProcessId(), GetCurrentThreadId());
return buf;
}
@@ -518,7 +516,7 @@ BOOL __stdcall ProcessRequest(HWND hwnd, LPARAM param)
// && try to OpenEvent() a event object name to it (prefixed with a string)
// this was fine for most Oses (not the best way) but now actually compares
// the class string (a bit slower) but should get rid of those bugs finally.
- hMirandaWorkEvent = OpenEventA(EVENT_ALL_ACCESS, false, CreateProcessUID(pid).c_str());
+ hMirandaWorkEvent = OpenEventA(EVENT_ALL_ACCESS, false, CreateProcessUID(pid, szBuf, sizeof(szBuf)));
if (hMirandaWorkEvent != 0) {
GetClassNameA(hwnd, szBuf, sizeof(szBuf));
if ( lstrcmpA(szBuf, MIRANDACLASS) != 0) {
@@ -717,7 +715,7 @@ HRESULT TShlComRec::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT _idCmdFir
ed.ipch = pipch;
// allocate a wait object so the ST can signal us, it can't be anon
// since it has to used by OpenEvent()
- lstrcpyA(pipch->SignalEventName, CreateUID().c_str());
+ CreateUID(pipch->SignalEventName, sizeof(pipch->SignalEventName));
// create the wait wait-for-wait object
ed.hWaitFor = CreateEventA(NULL, false, false, pipch->SignalEventName);
if (ed.hWaitFor != 0) {
@@ -805,7 +803,8 @@ HRESULT RequestTransfer(TShlComRec *Self, int idxCmd)
HRESULT hr = E_INVALIDARG;
if (Self->pDataObject != NULL) {
// OpenEvent() the work object to see if the instance is still around
- HANDLE hTransfer = OpenEventA(EVENT_ALL_ACCESS, false, CreateProcessUID(psd->pid).c_str());
+ char szBuf[100];
+ HANDLE hTransfer = OpenEventA(EVENT_ALL_ACCESS, false, CreateProcessUID(psd->pid, szBuf, sizeof(szBuf)));
if (hTransfer != 0) {
// map the ipc file again
HANDLE hMap = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, IPC_PACKET_SIZE, IPC_PACKET_NAME);
@@ -814,7 +813,7 @@ HRESULT RequestTransfer(TShlComRec *Self, int idxCmd)
THeaderIPC *pipch = (THeaderIPC*)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0);
if (pipch != NULL) {
// create the name of the object to be signalled by the ST
- lstrcpyA(pipch->SignalEventName, CreateUID().c_str());
+ lstrcpyA(pipch->SignalEventName, CreateUID(szBuf, sizeof(szBuf)));
// create it
HANDLE hReply = CreateEventA(NULL, false, false, pipch->SignalEventName);
if (hReply != 0) {
@@ -1486,7 +1485,8 @@ Reply:
void __cdecl ThreadServer(HANDLE hMainThread)
{
- HANDLE hEvent = CreateEventA(NULL, false, false, CreateProcessUID(GetCurrentProcessId()).c_str());
+ char szBuf[100];
+ HANDLE hEvent = CreateEventA(NULL, false, false, CreateProcessUID(GetCurrentProcessId(), szBuf, sizeof(szBuf)));
while (true) {
int retVal = WaitForSingleObjectEx(hEvent, INFINITE, true);
if (retVal == WAIT_OBJECT_0)
diff --git a/plugins/ShellExt/src/stdafx.h b/plugins/ShellExt/src/stdafx.h
index d84021d3e6..7fd95475d8 100644
--- a/plugins/ShellExt/src/stdafx.h
+++ b/plugins/ShellExt/src/stdafx.h
@@ -6,7 +6,6 @@
#include <Wincodec.h>
#include <string.h>
-#include <string>
#include <newpluginapi.h>
@@ -24,8 +23,6 @@
#include "Version.h"
-using namespace std;
-
#define MODULENAME "ShellExt"
#define SHLExt_Name "shlext15"
#define SHLExt_MRU "MRU"