
windows API
文章平均质量分 57
FanTasyCC
这个作者很懒,什么都没留下…
展开
-
游戏内存修改器原理
BOOLWINAPIReadProcessMemory( HANDLE hProcess, //待读进程的句柄 LPCVOID lpBaseAddress, //目标进程中待读内存的起始地址原创 2009-10-21 20:46:00 · 4848 阅读 · 0 评论 -
MultiByteToWideChar使用(核心编程描述有误)
<br />char szBuffer[MAX_PATH] = "1234567"; int nLen = ::MultiByteToWideChar(CP_ACP, 0, szBuffer, 9,//这里传-1的话,函数自动计算字符个数(包括'/0'),结果nLen = 8,如果不传-1,传5,6,7,那么返回将是这些值 NULL, 0); wchar_t* pwszBuffer = (wchar_t*)::LocalAlloc(0, nLen * sizeo原创 2010-09-15 15:12:00 · 921 阅读 · 0 评论 -
SDK关机
// test32.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include int _tmain(int argc, _TCHAR* argv[]){ HANDLE hToken = NULL; BOOL bResult = FALSE; TOKEN_PRIVILEGES tkp; bResult = ::OpenProcessToken(::GetCu原创 2010-06-24 15:11:00 · 993 阅读 · 0 评论 -
远程线程dll注入
<br />// injectDll.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <Windows.h>#include <Shlwapi.h>int _tmain(int argc, _TCHAR* argv[]){ //获取要注入的dll路径,我这里是放在本模块同一个路径下 TCHAR szDllPath[MAX_PATH] = { 0 };原创 2010-06-10 13:55:00 · 1094 阅读 · 0 评论 -
windows64位系统判断
<br />typedef BOOL WINAPI FN_ISWOW64_PROC(HANDLE hProcess, PBOOL Wow64Process);BOOL Is64bitWindows(void);BOOL Is64bitWindows(void){ BOOL bRet = FALSE;#ifdef _WIN64 bRet = FALSE; goto Exit0;#else OSVERSIONINFOEX osex; osex.dwOSVersionInf原创 2010-06-08 21:04:00 · 945 阅读 · 0 评论 -
windows系统信息
<br />// sysinfoTest.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <windows.h>#include <iostream>using namespace std;int Greater(int nNum);enum LEG{ LESS = -1, EQUAL = 0, GREATER = 1,};int原创 2010-06-06 20:51:00 · 687 阅读 · 0 评论 -
一个简单的线程池设计模型
<br />#pragma onceclass CXThreadJob{public: CXThreadJob(void); ~CXThreadJob(void);public: /* 用户对象纯虚函数 */ virtual void DoJob(void* pParam) = 0;};#pragma once#include <queue>#include "XThreadJob.h"class CXThreadPool{public:原创 2010-06-04 15:14:00 · 885 阅读 · 0 评论 -
windows服务程序初探
<br />// serviceProgram.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <Windows.h>//服务程序:当一个应用程序需要常驻系统,或者随时为其它应用程序提供服务时,可以使用服务应用程序SERVICE_STATUS g_SplSrvServieStatus;SERVICE_STATUS_HANDLE g_SplSrvService原创 2010-06-02 20:43:00 · 826 阅读 · 0 评论 -
托盘编程实例
// tryTest.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "tryTest.h"#include #define MAX_LOADSTRING 100NOTIFYICONDATA notifyIconData;HMENU hMenu;#de原创 2010-05-28 22:17:00 · 792 阅读 · 0 评论 -
改变文本控件字体
<br />//取得库存gdi对象 ::GetObject((HFONT)::GetStockObject(DEFAULT_GUI_FONT), sizeof(m_lf), &m_lf); m_lf.lfUnderline = TRUE;//加下划线 m_lf.lfHeight = 32;//高度 m_lf.lfWidth = 12;//宽度 m_newFont.CreateFontIndirect(&m_lf);//创建字体对象 //设置静态文本控件的字体 GetDlgItem原创 2010-07-06 19:23:00 · 1070 阅读 · 0 评论 -
注册表基本操作
<br />// regTest.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <Windows.h>#include <iostream>/*对于注册表,我们可以理解为(类比):键对应于文件夹,键值对应于文件*/VOID ErrorShow(DWORD dwErrorCode);VOID ErrorShow(DWORD dwErrorCo原创 2010-07-03 21:57:00 · 812 阅读 · 0 评论 -
遍历windows系统中的进程
PROCESSENTRY32 pe32; pe32.dwSize = sizeof(pe32); //给系统内的所以进程拍一个快照 HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (INVALID_HANDLE_VALUE == hProcessSnap) { goto原创 2010-04-22 10:07:00 · 1296 阅读 · 0 评论 -
共享内存(内存映射)
TCHAR szName[MAX_PATH] = _T("2010ShareMem"); //首先试图打开一个命名的内存映射文件对象 m_hMap = ::OpenFileMapping(FILE_MAP_ALL_ACCESS, 0, szName); if (m_hMap == NULL) { m_hMap = ::CreateFileMapping(INVALID_HAN原创 2010-04-22 11:39:00 · 1492 阅读 · 0 评论 -
Windows全局钩子dll(键盘)
// dllHookkb.cpp : Defines the entry point for the DLL application.//#include "stdafx.h"#include "dllHookkb.h"#ifdef _MANAGED#pragma managed(push, off)#endif#pragma data_seg("YCIShared原创 2010-04-22 15:56:00 · 3231 阅读 · 0 评论 -
Windows 内存DC
test原创 2010-04-16 14:10:00 · 1017 阅读 · 0 评论 -
采用GDI绘图和消息机制编写的小时钟(SDK)
// myTimer.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "myTimer.h"#include #define MAX_LOADSTRING 100// Global Variables:HINSTANCE hInst; // cu原创 2010-04-16 21:32:00 · 1109 阅读 · 1 评论 -
GetLogicalDrives,GetLogicalDriveStrings,GetDriveType
#include "stdafx.h"#include #include #include #include #ifdef _UNICODE#define tcout wcout#else#define tcout cout#endifint _tmain(int argc, _TCHAR* argv[]){ TCHAR tables[][4]原创 2009-11-16 09:23:00 · 2666 阅读 · 0 评论 -
浏览文件夹对话框代码段
LPMALLOC pMalloc; if(::SHGetMalloc(&pMalloc) == NOERROR) { BROWSEINFO bi; TCHAR pszBuffer[MAX_PATH]; LPITEMIDLIST pidl; bi.hwndOwner = GetSafeHwnd(); bi.pidlRoot = NULL;原创 2009-10-30 20:21:00 · 811 阅读 · 0 评论 -
超时功能的MessageBox对话框
前天突然在windbg上uf USER32!MessageBoxW,发现了MessageBoxTimeoutW这个API,看着名字大家马上就知道什么回事了。为什么对这个有如此敏感呢,是因为有一次面试经历,问了这个问题,怎么实现具有超时功能的MessageBox,我那时的回答是:在一个线程中弹对话框,然后等待此线程(现在想想很汗)#include "stdafx.h"#include #include int _tmain(int argc, _TCHAR* argv[]){原创 2011-05-14 18:30:00 · 2728 阅读 · 0 评论