黑客软件编写基础知识集合(1)

时间:2006-10-12 来源: 作者: 点击:
确定Windows和windows系统目录 有两个SDK函数可以完成该功能。GetWindowsDirectory和GetSystemDirectory,下例说明了如何使用这两个函数: TCHAR szDir [MAX_PATH]; //Get the full path of the windows directory. :: GetWindowsDirectory (szDir, MAX_PATH); TRACE (
  
  确定Windows和windows系统目录
  
  有两个SDK函数可以完成该功能。GetWindowsDirectory和GetSystemDirectory,下例说明了如何使用这两个函数:
  
  TCHAR szDir [MAX_PATH];
  
  //Get the full path of the windows directory.
  
  :: GetWindowsDirectory (szDir, MAX_PATH);
  
  TRACE ("Windows directory %s\n", szDir);
  
  //Get the full path of the windows system directory.
  
  :: GetSystemDirectory (szDir, MAX_PATH);
  
  TRACE ("Windows system directory %s\n", szDir);
  ***********************************************
  
  让程序从CTRL+ATL+DEL消失
  
  使用Win32 API函数RegisterServiceProcess这里我们使用了汇编。
  
  #include
  
  HINSTANCE hLibrary;
  void *regproc;
  
  void CADInit(void);
  void HideApp(void);
  void ShowApp(void);
  void CADClean(void);
  
  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  {
  CADInit(); //加载 DLL 并创建一指向它指针
  HideApp(); //隐藏程序
  //ShowApp(); //显示程序
  
  //其他处理或调用
  
  CADClean(); //卸载 DLL
  return 0; //retrun 0 因为没有进入消息循环
  }
  
  void CADInit(void)
  {
  //加载 kernel32.dll
  hLibrary = LoadLibrary("kernel32.dll");
  //获取函数RegisterServiceProcess的地址
  regproc = GetProcAddress(hLibrary, "RegisterServiceProcess");
  }
  
  void HideApp(void)
  {
  //实现程序的隐藏
  __asm
  {
  push 1
  push 0
  call regproc
  }
  return;
  }
  
  void ShowApp(void)
  {
  //恢复状态
  __asm
  {
  push 0
  push 0
  call regproc
  }
  return;
  }
  
  void CADClean(void)
  {
  //卸载 DLL
  FreeLibrary(hLibrary);
  return;
  }
  本程序在W2K和Win9x测试通过。
------分隔线----------------------------
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
最新评论 查看所有评论
发表评论 查看所有评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
推荐内容