forked from Shilyx/MultiWeChat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WeChat.h
27 lines (22 loc) · 816 Bytes
/
WeChat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef _WECHAT_H
#define _WECHAT_H
#include <Windows.h>
#include <AclAPI.h>
static void EnableMultiWeChat()
{
HANDLE hMutex = CreateMutexW(NULL, FALSE, L"_WeChat_App_Instance_Identity_Mutex_Name");
SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY;
PSID pEveryoneSID = NULL; // everyoneȺ×éSID
char szBuffer[4096];
PACL pAcl = (PACL)szBuffer;
AllocateAndInitializeSid(
&SIDAuthWorld,
1,
SECURITY_WORLD_RID,
0, 0, 0, 0, 0, 0, 0,
&pEveryoneSID);
InitializeAcl(pAcl, sizeof(szBuffer), ACL_REVISION);
AddAccessDeniedAce(pAcl, ACL_REVISION, MUTEX_ALL_ACCESS, pEveryoneSID);
SetSecurityInfo(hMutex, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, pAcl, NULL);
}
#endif /* _WECHAT_H */