mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2025-02-25 14:34:50 +01:00
All: Prepared some headers for C++
This commit is contained in:
parent
a57471feb2
commit
f027a36837
@ -1619,7 +1619,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BeginExplorerRestart();
|
BeginExplorerRestart(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Sleep(100);
|
Sleep(100);
|
||||||
|
@ -11001,16 +11001,16 @@ BOOL FixStartMenuAnimation(LPMODULEINFO mi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DWORD dwOldProtect = 0;
|
DWORD dwOldProtect = 0;
|
||||||
if (VirtualProtect(match7a + 11, 3, PAGE_EXECUTE_READWRITE, &dwOldProtect))
|
if (VirtualProtect(match7a + 11, 1, PAGE_EXECUTE_READWRITE, &dwOldProtect))
|
||||||
{
|
{
|
||||||
match7a[0] = 0xEB;
|
match7a[0] = 0xEB;
|
||||||
VirtualProtect(match7a + 11, 3, dwOldProtect, &dwOldProtect);
|
VirtualProtect(match7a + 11, 1, dwOldProtect, &dwOldProtect);
|
||||||
|
|
||||||
dwOldProtect = 0;
|
dwOldProtect = 0;
|
||||||
if (VirtualProtect(match7b + 11, 3, PAGE_EXECUTE_READWRITE, &dwOldProtect))
|
if (VirtualProtect(match7b + 11, 1, PAGE_EXECUTE_READWRITE, &dwOldProtect))
|
||||||
{
|
{
|
||||||
match7b[0] = 0xEB;
|
match7b[0] = 0xEB;
|
||||||
VirtualProtect(match7b + 11, 3, dwOldProtect, &dwOldProtect);
|
VirtualProtect(match7b + 11, 1, dwOldProtect, &dwOldProtect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,5 +5,15 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
FILE* fmemopen(void* buf, size_t len, const char* type);
|
FILE* fmemopen(void* buf, size_t len, const char* type);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -5,8 +5,16 @@
|
|||||||
#include <BaseTsd.h>
|
#include <BaseTsd.h>
|
||||||
typedef SSIZE_T ssize_t;
|
typedef SSIZE_T ssize_t;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
ssize_t getdelim(char** buf, size_t* bufsiz, int delimiter, FILE* fp);
|
ssize_t getdelim(char** buf, size_t* bufsiz, int delimiter, FILE* fp);
|
||||||
|
|
||||||
ssize_t getline(char** buf, size_t* bufsiz, FILE* fp);
|
ssize_t getline(char** buf, size_t* bufsiz, FILE* fp);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -20,6 +20,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#define DWMWA_MICA_EFFFECT 1029
|
#define DWMWA_MICA_EFFFECT 1029
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
extern RTL_OSVERSIONINFOW global_rovi;
|
extern RTL_OSVERSIONINFOW global_rovi;
|
||||||
extern DWORD32 global_ubr;
|
extern DWORD32 global_ubr;
|
||||||
|
|
||||||
@ -94,4 +98,9 @@ inline BOOL IsWindows11Version22H2Build2361OrHigher()
|
|||||||
if (global_rovi.dwBuildNumber > 22621) return TRUE;
|
if (global_rovi.dwBuildNumber > 22621) return TRUE;
|
||||||
return global_rovi.dwBuildNumber == 22621 && global_ubr >= 2361;
|
return global_rovi.dwBuildNumber == 22621 && global_ubr >= 2361;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -163,7 +163,7 @@ LRESULT CALLBACK BalloonWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(dllexport) CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
__declspec(dllexport) int CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
||||||
{
|
{
|
||||||
TCHAR* lpwszCmdLine = calloc((strlen(lpszCmdLine) + 1), sizeof(TCHAR));
|
TCHAR* lpwszCmdLine = calloc((strlen(lpszCmdLine) + 1), sizeof(TCHAR));
|
||||||
if (!lpwszCmdLine) exit(0);
|
if (!lpwszCmdLine) exit(0);
|
||||||
@ -199,6 +199,8 @@ __declspec(dllexport) CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance, LPS
|
|||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t TestToastXML[] =
|
const wchar_t TestToastXML[] =
|
||||||
@ -212,7 +214,7 @@ L" </binding>\r\n"
|
|||||||
L" </visual>\r\n"
|
L" </visual>\r\n"
|
||||||
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
|
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
|
||||||
L"</toast>\r\n";
|
L"</toast>\r\n";
|
||||||
__declspec(dllexport) CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
__declspec(dllexport) int CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
||||||
{
|
{
|
||||||
TCHAR* lpwszCmdLine = calloc((strlen(lpszCmdLine) + 1), sizeof(TCHAR));
|
TCHAR* lpwszCmdLine = calloc((strlen(lpszCmdLine) + 1), sizeof(TCHAR));
|
||||||
if (!lpwszCmdLine) exit(0);
|
if (!lpwszCmdLine) exit(0);
|
||||||
@ -252,9 +254,10 @@ __declspec(dllexport) CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, LPSTR
|
|||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
free(lpwszCmdLine);
|
free(lpwszCmdLine);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(dllexport) CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
__declspec(dllexport) int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
||||||
{
|
{
|
||||||
Sleep(100);
|
Sleep(100);
|
||||||
TCHAR wszExplorerPath[MAX_PATH + 1];
|
TCHAR wszExplorerPath[MAX_PATH + 1];
|
||||||
@ -283,18 +286,21 @@ __declspec(dllexport) CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance,
|
|||||||
),
|
),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(dllexport) CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
__declspec(dllexport) int CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
||||||
{
|
{
|
||||||
Sleep(2000);
|
Sleep(2000);
|
||||||
ZZLaunchExplorer(hWnd, hInstance, lpszCmdLine, nCmdShow);
|
ZZLaunchExplorer(hWnd, hInstance, lpszCmdLine, nCmdShow);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(dllexport) CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
__declspec(dllexport) int CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
||||||
{
|
{
|
||||||
BeginExplorerRestart();
|
BeginExplorerRestart(NULL);
|
||||||
FinishExplorerRestart();
|
FinishExplorerRestart();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ReadFromFile(wchar_t* wszFileName, DWORD* dwSize)
|
void* ReadFromFile(wchar_t* wszFileName, DWORD* dwSize)
|
||||||
|
@ -15,18 +15,25 @@
|
|||||||
#include <restartmanager.h>
|
#include <restartmanager.h>
|
||||||
#pragma comment(lib, "Rstrtmgr.lib")
|
#pragma comment(lib, "Rstrtmgr.lib")
|
||||||
#define _LIBVALINET_INCLUDE_UNIVERSAL
|
#define _LIBVALINET_INCLUDE_UNIVERSAL
|
||||||
|
#ifndef __cplusplus
|
||||||
#include <valinet/universal/toast/toast.h>
|
#include <valinet/universal/toast/toast.h>
|
||||||
|
#endif
|
||||||
#include "osutility.h"
|
#include "osutility.h"
|
||||||
#include "queryversion.h"
|
#include "queryversion.h"
|
||||||
#pragma comment(lib, "Psapi.lib")
|
#pragma comment(lib, "Psapi.lib")
|
||||||
#include <activscp.h>
|
#include <activscp.h>
|
||||||
#include <netlistmgr.h>
|
#include <netlistmgr.h>
|
||||||
|
#include <Psapi.h>
|
||||||
|
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
|
|
||||||
#define WM_MSG_GUI_SECTION WM_USER + 1
|
#define WM_MSG_GUI_SECTION WM_USER + 1
|
||||||
#define WM_MSG_GUI_SECTION_GET 1
|
#define WM_MSG_GUI_SECTION_GET 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
DEFINE_GUID(CLSID_ImmersiveShell,
|
DEFINE_GUID(CLSID_ImmersiveShell,
|
||||||
0xc2f03a33,
|
0xc2f03a33,
|
||||||
0x21f5, 0x47fa, 0xb4, 0xbb,
|
0x21f5, 0x47fa, 0xb4, 0xbb,
|
||||||
@ -245,15 +252,15 @@ void printf_guid(GUID guid);
|
|||||||
|
|
||||||
LRESULT CALLBACK BalloonWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
LRESULT CALLBACK BalloonWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
__declspec(dllexport) CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
__declspec(dllexport) int CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||||
|
|
||||||
__declspec(dllexport) CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
__declspec(dllexport) int CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||||
|
|
||||||
__declspec(dllexport) CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
__declspec(dllexport) int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||||
|
|
||||||
__declspec(dllexport) CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
__declspec(dllexport) int CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||||
|
|
||||||
__declspec(dllexport) CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
__declspec(dllexport) int CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||||
|
|
||||||
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
|
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
|
||||||
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
|
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
|
||||||
@ -297,7 +304,7 @@ inline LSTATUS SHRegGetValueFromHKCUHKLMWithOpt(
|
|||||||
pwszValue,
|
pwszValue,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
pvData,
|
(LPBYTE)pvData,
|
||||||
pcbData
|
pcbData
|
||||||
);
|
);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
@ -324,7 +331,7 @@ inline LSTATUS SHRegGetValueFromHKCUHKLMWithOpt(
|
|||||||
pwszValue,
|
pwszValue,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
pvData,
|
(LPBYTE)pvData,
|
||||||
pcbData
|
pcbData
|
||||||
);
|
);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
@ -517,7 +524,7 @@ static DWORD RmSession = -1;
|
|||||||
static wchar_t RmSessionKey[CCH_RM_SESSION_KEY + 1];
|
static wchar_t RmSessionKey[CCH_RM_SESSION_KEY + 1];
|
||||||
|
|
||||||
// shuts down the explorer and is ready for explorer restart
|
// shuts down the explorer and is ready for explorer restart
|
||||||
inline void BeginExplorerRestart()
|
inline DWORD WINAPI BeginExplorerRestart(LPVOID lpUnused)
|
||||||
{
|
{
|
||||||
if (RmStartSession(&RmSession, 0, RmSessionKey) == ERROR_SUCCESS)
|
if (RmStartSession(&RmSession, 0, RmSessionKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -535,6 +542,7 @@ inline void BeginExplorerRestart()
|
|||||||
RmShutdown(RmSession, RmForceShutdown, 0);
|
RmShutdown(RmSession, RmForceShutdown, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
// restarts the explorer
|
// restarts the explorer
|
||||||
inline void FinishExplorerRestart()
|
inline void FinishExplorerRestart()
|
||||||
@ -673,8 +681,9 @@ inline BOOL IncrementDLLReferenceCount(HINSTANCE hinst)
|
|||||||
HMODULE hMod;
|
HMODULE hMod;
|
||||||
GetModuleHandleExW(
|
GetModuleHandleExW(
|
||||||
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
|
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
|
||||||
hinst,
|
(LPCWSTR)hinst,
|
||||||
&hMod);
|
&hMod);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline BOOL WINAPI PatchContextMenuOfNewMicrosoftIME(BOOL* bFound)
|
inline BOOL WINAPI PatchContextMenuOfNewMicrosoftIME(BOOL* bFound)
|
||||||
@ -786,7 +795,7 @@ BOOL ExtractMonitorByIndex(HMONITOR hMonitor, HDC hDC, LPRECT lpRect, MonitorOve
|
|||||||
|
|
||||||
inline BOOL MaskCompare(PVOID pBuffer, LPCSTR lpPattern, LPCSTR lpMask)
|
inline BOOL MaskCompare(PVOID pBuffer, LPCSTR lpPattern, LPCSTR lpMask)
|
||||||
{
|
{
|
||||||
for (PBYTE value = pBuffer; *lpMask; ++lpPattern, ++lpMask, ++value)
|
for (PBYTE value = (PBYTE)pBuffer; *lpMask; ++lpPattern, ++lpMask, ++value)
|
||||||
{
|
{
|
||||||
if (*lpMask == 'x' && *(LPCBYTE)lpPattern != *value)
|
if (*lpMask == 'x' && *(LPCBYTE)lpPattern != *value)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -810,3 +819,7 @@ inline PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lp
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -673,7 +673,7 @@ int WINAPI wWinMain(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BeginExplorerRestart();
|
BeginExplorerRestart(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user