forked from Bush2021/chrome_plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappid.h
33 lines (28 loc) · 911 Bytes
/
appid.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
28
29
30
31
32
33
#ifndef APPID_H_
#define APPID_H_
#include <propkey.h>
#include <propvarutil.h>
#include <shobjidl.h>
auto RawPSStringFromPropertyKey = PSStringFromPropertyKey;
HRESULT WINAPI MyPSStringFromPropertyKey(REFPROPERTYKEY pkey,
LPWSTR psz,
UINT cch) {
HRESULT result = RawPSStringFromPropertyKey(pkey, psz, cch);
if (SUCCEEDED(result)) {
if (pkey == PKEY_AppUserModel_ID) {
// DebugLog(L"MyPSStringFromPropertyKey %s", psz);
return -1;
}
}
return result;
}
void SetAppId() {
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach((LPVOID*)&RawPSStringFromPropertyKey, MyPSStringFromPropertyKey);
auto status = DetourTransactionCommit();
if (status != NO_ERROR) {
DebugLog(L"SetAppId failed %d", status);
}
}
#endif // APPID_H_