mirror of
https://gitea.tendokyu.moe/Hay1tsme/segatools.git
synced 2026-05-06 05:15:42 -05:00
misc: add GetDriveType hook
This commit is contained in:
parent
e4bd0543c9
commit
0be4b47448
|
|
@ -161,6 +161,14 @@ static DWORD WINAPI hook_GetPrivateProfileSectionW(
|
|||
LPCWSTR lpFileName
|
||||
);
|
||||
|
||||
static UINT WINAPI hook_GetDriveTypeA(
|
||||
LPCSTR lpRootPathName
|
||||
);
|
||||
|
||||
static UINT WINAPI hook_GetDriveTypeW(
|
||||
LPCWSTR lpRootPathName
|
||||
);
|
||||
|
||||
/* Link pointers */
|
||||
|
||||
static BOOL (WINAPI *next_CreateDirectoryA)(
|
||||
|
|
@ -303,6 +311,14 @@ static DWORD (WINAPI *next_GetPrivateProfileSectionW)(
|
|||
LPCWSTR lpFileName
|
||||
);
|
||||
|
||||
static UINT (WINAPI *next_GetDriveTypeW)(
|
||||
LPCWSTR lpRootPathName
|
||||
);
|
||||
|
||||
static UINT (WINAPI *next_GetDriveTypeA)(
|
||||
LPCSTR lpRootPathName
|
||||
);
|
||||
|
||||
/* Hook table */
|
||||
|
||||
static const struct hook_symbol path_hook_syms[] = {
|
||||
|
|
@ -418,6 +434,14 @@ static const struct hook_symbol path_hook_syms[] = {
|
|||
.name = "GetPrivateProfileSectionW",
|
||||
.patch = hook_GetPrivateProfileSectionW,
|
||||
.link = (void **) &next_GetPrivateProfileSectionW,
|
||||
}, {
|
||||
.name = "GetDriveTypeA",
|
||||
.patch = hook_GetDriveTypeA,
|
||||
.link = (void **) &next_GetDriveTypeA,
|
||||
}, {
|
||||
.name = "GetDriveTypeW",
|
||||
.patch = hook_GetDriveTypeW,
|
||||
.link = (void **) &next_GetDriveTypeW,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1338,3 +1362,35 @@ static DWORD WINAPI hook_GetPrivateProfileSectionW(
|
|||
|
||||
return next_GetPrivateProfileSectionW(lpAppName, lpReturnedString, nSize, trans ? trans: lpFileName);
|
||||
}
|
||||
|
||||
|
||||
static UINT WINAPI hook_GetDriveTypeA(
|
||||
LPCSTR lpRootPathName
|
||||
) {
|
||||
char *trans;
|
||||
BOOL ok;
|
||||
|
||||
ok = path_transform_a(&trans, lpRootPathName);
|
||||
|
||||
if (!ok) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return next_GetDriveTypeA(trans ? trans : lpRootPathName);
|
||||
}
|
||||
|
||||
|
||||
static UINT WINAPI hook_GetDriveTypeW(
|
||||
LPCWSTR lpRootPathName
|
||||
) {
|
||||
wchar_t *trans;
|
||||
BOOL ok;
|
||||
|
||||
ok = path_transform_w(&trans, lpRootPathName);
|
||||
|
||||
if (!ok) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return next_GetDriveTypeW(trans ? trans : lpRootPathName);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user