waliedassar

SystemComPlusPackage

Dec 8th, 2012
479
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×