Advertisement
waliedassar

SystemComPlusPackage

Dec 8th, 2012
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.96 KB | None | 0 0
  1. //This trick enables you to share a dword value between:
  2. // 1) All user-mode processes.
  3. // 2) User-mode and Kernel-Mode.
  4. #include "stdafx.h"
  5. #include "windows.h"
  6. #include "stdio.h"
  7.  
  8. #define SystemComPlusPackage 0x3B
  9.  
  10.  
  11. extern "C"
  12. {
  13.     int __stdcall ZwSetSystemInformation(unsigned long  SystemInformationClass,
  14.                                          unsigned long* SystemInformation,
  15.                                          unsigned long  SystemInformationLength);
  16. }
  17.  
  18. int main(int argc, char* argv[])
  19. {
  20.     unsigned long i=0;
  21.     printf("Enter the value you want to share with all processes ");
  22.     scanf("%d",&i);
  23.     if(i)
  24.     {
  25.         ZwSetSystemInformation(SystemComPlusPackage,&i,0x4);
  26.         void* SharedUserData=(void*)0x7FFE02E0;
  27.         unsigned long SharedValue=*(unsigned long*)((unsigned char*)SharedUserData);
  28.         printf("Shared value is %d\r\n",SharedValue);
  29.         printf("You can ensure that by checking value at address 0x7FFE02E0 in user-mode\r\nand at address 0xFFDF02E0 in kernel-mode\r\n");
  30.     }
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement