Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This trick enables you to share a dword value between:
- // 1) All user-mode processes.
- // 2) User-mode and Kernel-Mode.
- #include "stdafx.h"
- #include "windows.h"
- #include "stdio.h"
- #define SystemComPlusPackage 0x3B
- extern "C"
- {
- int __stdcall ZwSetSystemInformation(unsigned long SystemInformationClass,
- unsigned long* SystemInformation,
- unsigned long SystemInformationLength);
- }
- int main(int argc, char* argv[])
- {
- unsigned long i=0;
- printf("Enter the value you want to share with all processes ");
- scanf("%d",&i);
- if(i)
- {
- ZwSetSystemInformation(SystemComPlusPackage,&i,0x4);
- void* SharedUserData=(void*)0x7FFE02E0;
- unsigned long SharedValue=*(unsigned long*)((unsigned char*)SharedUserData);
- printf("Shared value is %d\r\n",SharedValue);
- printf("You can ensure that by checking value at address 0x7FFE02E0 in user-mode\r\nand at address 0xFFDF02E0 in kernel-mode\r\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement