2018年10月8日

c语言解决函数变参数问题 va_list

摘要: 前言:看到sprintf,swprintf之类的可变参数格式化函数,是否想过我们能写一个自定义的类似的函数吗?答案是很定的,下面来介绍一种方法,用va_list,va_start, va_end来实现。 va_list是一个宏,使用的时候先定义一个变量,然后用va_start来初始化,使用完后用va 阅读全文

posted @ 2018-10-08 19:24 priarieNew 阅读(1175) 评论(0) 推荐(0)

内核下枚举进程(一)进程活动链

摘要: 今天学会了一种在内核下枚举进程的方法,写下来与大家共享。用到了的是EPROCESS 结构,EPROCESS 是一个关于进程的结构,此结构很庞大,包括的内容非常丰富.由于此结构未文档化所以用windbg来查看输入dt _eprocess命令查看该结构如下: 从上述结构中可以看出ActiveProces 阅读全文

posted @ 2018-10-08 19:01 priarieNew 阅读(761) 评论(0) 推荐(0)

winDbg + VMware + window 双机联调环境搭建

摘要: 这里简单的介绍一下内核开发双机联调的搭建环境,尽管网上有很多类似的文章,但看了很多总是不太舒服,觉得不太明白,所以自己实践一下总结一篇。下面就拿我的环境简单介绍,希望别人可以看懂。准备工具:装虚拟机VMware,安装被调试机OS(笔者的是win7 x86)笔者的真机OS版本为 win8.1 x64( 阅读全文

posted @ 2018-10-08 18:54 priarieNew 阅读(2053) 评论(0) 推荐(0)

EnumProcess 实现枚举进程

摘要: BOOL WINAPI EnumProcesses ( _Out_writes_bytes_(cb) DWORD * lpidProcess, _In_ DWORD cb, _Out_ LPDWORD lpcbNeeded... 阅读全文

posted @ 2018-10-08 18:49 priarieNew 阅读(1525) 评论(0) 推荐(0)

NtQuerySystemInformation 枚举进程

摘要: 函数原型: NTSTATUS WINAPI NtQuerySystemInformation( _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, _Inout_ PVOID SystemInformation, _In_ ULONG Syst 阅读全文

posted @ 2018-10-08 18:45 priarieNew 阅读(2536) 评论(0) 推荐(0)

Windows API GetShortPathName GetLongPathName

摘要: 函数原型: The GetShortPathName function retrieves the short path form of a specified input path. DWORD GetShortPathName( LPCTSTR lpszLongPath, // null-ter 阅读全文

posted @ 2018-10-08 18:43 priarieNew 阅读(1096) 评论(0) 推荐(0)

检查进程是否被调试

摘要: 转自:http://www.cnblogs.com/this-543273659/archive/2013/03/04/2943380.html 在调试一些病毒程序的时候,可能会碰到一些反调试技术,也就是说,被调试的程序可以检测到自己是否被调试器附加了,如果探知自己正在被调试,肯定是有人试图反汇编啦 阅读全文

posted @ 2018-10-08 18:29 priarieNew 阅读(2818) 评论(0) 推荐(0)

查找父进程,进程的PEB 进程是否被调试 NtQueryInformationProcess

摘要: //说明:把Reserved3转化为DWORD后一定会得到devenv.exe 进程的ID,dwParentID也可以说明问题 //说明:这是peb字段,我们看到BeingDebugged字段已经被置为1,说明正在被调试, SessionId:字段也显示出了该进程的会话ID其它字段可以在深入的研究, 阅读全文

posted @ 2018-10-08 17:47 priarieNew 阅读(2417) 评论(0) 推荐(0)

Windows API 25篇 TerminateProcess

摘要: 导语:结束一个进程的方法通常有:exit(), ExitProcess, TerminateProcess. 通常一个进程在正常情况下结束的话,系统会调用 ExitProcess函数结束进程,但有时候想强行杀掉一个进程的话就必须调用TerminateProcess函数了,TerminateProce 阅读全文

posted @ 2018-10-08 17:43 priarieNew 阅读(2021) 评论(0) 推荐(0)

window API GetProcessId OpenProcess

摘要: 函数原型: 阅读全文

posted @ 2018-10-08 17:42 priarieNew 阅读(1747) 评论(0) 推荐(0)

Windowns API 第24篇 WTSEnumerateSessions 枚举session信息

摘要: 函数原型: BOOL WTSEnumerateSessions( HANDLE hServer, DWORD Reserved, DWORD Version, ... 阅读全文

posted @ 2018-10-08 17:31 priarieNew 阅读(1754) 评论(0) 推荐(0)

Windows API 23 篇 WTSQuerySessionInformation

摘要: 函数原型:BOOLWINAPIWTSQuerySessionInformationW( IN HANDLE hServer, IN DWORD SessionId, IN WTS_INFO_CLASS WTSInfoClass, __deref_out_bcount(*pBytesReturned) 阅读全文

posted @ 2018-10-08 17:29 priarieNew 阅读(1461) 评论(0) 推荐(0)

windows API 第22篇 WTSGetActiveConsoleSessionId

摘要: 函数原型:DWORD WTSGetActiveConsoleSessionId (VOID)先看一下原文介绍: The WTSGetActiveConsoleSessionId function retrieves the Terminal Services session currently at 阅读全文

posted @ 2018-10-08 17:28 priarieNew 阅读(5064) 评论(0) 推荐(0)

获取当前活动窗口后(前景窗口)可以做好多事情

摘要: 相关函数://获取当前活动窗口HWND GetForegroundWindow(VOID);//获取窗口名int GetWindowText( HWND hWnd, // handle to window or control LPTSTR lpString, // text buffer int 阅读全文

posted @ 2018-10-08 17:17 priarieNew 阅读(2216) 评论(0) 推荐(0)

Windows API 第21篇 DeleteVolumeMountPoint 删除挂载点

摘要: 函数原型:BOOL DeleteVolumeMountPoint( LPCTSTR lpszVolumeMountPoint // volume mount point path );参数:lpszVolumeMountPoint :挂载点路径,必须以反斜杠'\'结尾。 Remarks It is 阅读全文

posted @ 2018-10-08 17:09 priarieNew 阅读(1210) 评论(0) 推荐(0)

Windows API 第20篇 SetVolumeMountPoint 设置卷挂载点参数错误

摘要: 函数原型:BOOL SetVolumeMountPoint( IN LPCTSTR lpszVolumeMountPoint, // mount point IN LPCTSTR lpszVolumeName // volume to be mounted );参数:lpszVolumeMountP 阅读全文

posted @ 2018-10-08 17:07 priarieNew 阅读(1847) 评论(0) 推荐(0)

Windows API 第20篇 GetVolumeNameForVolumeMountPoint

摘要: 函数原型:BOOL GetVolumeNameForVolumeMountPoint( IN LPCTSTR lpszVolumeMountPoint, // volume mount point or directory OUT LPTSTR lpszVolumeName, // volume n 阅读全文

posted @ 2018-10-08 17:06 priarieNew 阅读(1542) 评论(0) 推荐(0)

Windows API 第19篇 FindFirstVolumeMountPoint FindNextVolumeMountPoint

摘要: 相关函数:HANDLE FindFirstVolumeMountPoint( LPTSTR lpszRootPathName, // volume name LPTSTR lpszVolumeMountPoint, // output buffer DWORD cchBufferLength // 阅读全文

posted @ 2018-10-08 17:02 priarieNew 阅读(841) 评论(0) 推荐(0)

windows API 第 18篇 FindFirstVolume FindNextVolume

摘要: 函数定义:Retrieves the name of a volume on a computer. FindFirstVolume is used to begin scanning the volumes of a computer. 我的输出结果是这样的: 分析: 可见这些也代表着卷标的唯一标 阅读全文

posted @ 2018-10-08 16:55 priarieNew 阅读(905) 评论(0) 推荐(0)

Windows API 第17篇 GetLogicalDriveStrings 获取本机所有逻辑驱动器,以根目录的形式表示

摘要: 函数原型:DWORD GetLogicalDriveStrings( DWORD nBufferLength, // size of buffer LPTSTR lpBuffer // drive strings buffer );说明:参数不多讲,需要注意函数返回存入lpBuffer空间的字符个数 阅读全文

posted @ 2018-10-08 16:51 priarieNew 阅读(944) 评论(0) 推荐(0)

Windows API 第16篇 GetLogicalDrivers 获取驱动器位掩码

摘要: 函数原型:DWORD GetLogicalDrives(VOID);The GetLogicalDrives function retrieves a bitmask representing the currently available disk drives. 说明:该函数用法简单,没有参数, 阅读全文

posted @ 2018-10-08 16:32 priarieNew 阅读(783) 评论(0) 推荐(0)

Windows API 第15篇 GetVolumeInformation 获取磁盘卷(驱动器)信息

摘要: 先看定义:BOOL GetVolumeInformation( [IN] LPCTSTR lpRootPathName, // root directory 卷所在的根目录,如:"C:\\", 如果为NULL,表示当前目录 [OUT] LPTSTR lpVolumeNameBuffer, // vo 阅读全文

posted @ 2018-10-08 16:31 priarieNew 阅读(8372) 评论(1) 推荐(0)

GetCommandLine CmdLineToArgvW

摘要: 说明:LPTSTR GetCommandLine(VOID);LPWSTR * CommandLineToArgvW( LPCWSTR lpCmdLine, // pointer to a command-line string int *pNumArgs // receives the argum 阅读全文

posted @ 2018-10-08 15:43 priarieNew 阅读(1723) 评论(0) 推荐(0)

Windows API 第14篇 DeleteAndRenameFile

摘要: 函数定义:BOOL DeleteAndRenameFile( LPCWSTR lpszDestFile, LPCWSTR lpszSourFile );说明:函数把sourceFile的内容复制到DestFile中,然后再删除sourceFile。调用前必须保证sourceFile和DestFile 阅读全文

posted @ 2018-10-08 15:31 priarieNew 阅读(508) 评论(0) 推荐(0)

windows API 第13篇 MoveFileEx

摘要: MoveFileEx 删除文件 注册表 阅读全文

posted @ 2018-10-08 15:14 priarieNew 阅读(2745) 评论(0) 推荐(2)

Windows API 第12篇 MoveFile

摘要: MoveFile可以移动文件,更名文件,移动目录(包括目录下的所有文件以及子目录)。函数定义:BOOL MoveFile( LPCTSTR lpExistingFileName, // file name LPCTSTR lpNewFileName // new file name);参数不介绍了, 阅读全文

posted @ 2018-10-08 15:13 priarieNew 阅读(1836) 评论(0) 推荐(0)

_strupr _wcsupr _mbsupr

摘要: 将字符串转化为大写的形式(Convert a string to uppercase.)定义: char *_strupr( char *string ); wchar_t *_wcsupr( wchar_t *string ); unsigned char *_mbsupr( unsigned c 阅读全文

posted @ 2018-10-08 15:09 priarieNew 阅读(1088) 评论(0) 推荐(0)

复制字符串 _strdup _wcsdup _mbsdup

摘要: Duplicate strings.函数定义: char *_strdup( const char *strSource ); wchar_t *_wcsdup( const wchar_t *strSource ); unsigned char *_mbsdup( const unsigned c 阅读全文

posted @ 2018-10-08 15:08 priarieNew 阅读(658) 评论(0) 推荐(0)

windows API 第 11 篇 GetCurrentDirectory SetCurrentDirectory

摘要: GetCurrentDirectory函数获得当前文件所在的目录,并不是进程的目录(debug 和 release),它和GetCommandLine不同这里只讲 GetCurrentDirectory,GetCurrentDirectory是一个宏#ifdef UNICODE#define Get 阅读全文

posted @ 2018-10-08 15:04 priarieNew 阅读(756) 评论(0) 推荐(0)

Windows API 第 10篇 SearchTreeForFile

摘要: 函数原型:BOOL SearchTreeForFile( PSTR RootPath, //系统查找的起始路径, PSTR InputPathName, //要查找的文件名,可以使用通配符,例如 *.doc PSTR OutputPathBuffer ); //输出参数,查找到以后文件的绝对路径放在 阅读全文

posted @ 2018-10-08 14:57 priarieNew 阅读(601) 评论(0) 推荐(0)

windows 遍历目录下的所有文件 FindFirstFile FindNextFile

摘要: Windows下遍历文件时用到的就是FindFirstFile 和FindNextFile 首先看一下定义: 阅读全文

posted @ 2018-10-08 14:49 priarieNew 阅读(6800) 评论(0) 推荐(1)

gethostname gethostbyname gethostbyaddr 获得主机相关信息

摘要: 网络编程里经常需要获得主机的相关信息,下面围绕相关的函数以及用到的结构来说明。 The gethostbyname function retrieves host information corresponding to a host name from a host database. Note 阅读全文

posted @ 2018-10-08 14:39 priarieNew 阅读(572) 评论(0) 推荐(0)

_itoa _itow _itot atoi atof atol

摘要: 函数原型: Convert strings to double (atof), integer (atoi, _atoi64), or long (atol). 阅读全文

posted @ 2018-10-08 14:28 priarieNew 阅读(603) 评论(0) 推荐(0)

Window API 第五篇 WTSEnumerateProcesses

摘要: 这个函数可用来枚举系统进程,先来看定义: 阅读全文

posted @ 2018-10-08 14:26 priarieNew 阅读(1857) 评论(0) 推荐(0)

获取计算机以及本机信息API

摘要: 获取计算机名: 阅读全文

posted @ 2018-10-08 14:21 priarieNew 阅读(1543) 评论(0) 推荐(0)

Windows API 第二篇 SHGetSpecialFolderPath

摘要: BOOL SHGetSpecialFolderPath( HWND hwndOwner, LPTSTR lpszPath, int nFolder, BOOL fCreate ); 参数解释: hwndOwner:Handle to the owner window the client shoul 阅读全文

posted @ 2018-10-08 13:54 priarieNew 阅读(259) 评论(0) 推荐(0)

API 练习 第一篇

摘要: 练习API CreateSemaphoreCreateEvent ReleaseSemapWaitForSingleObject CloseHandleInitializeCriticalSectionEnterCriticalSectionLeaveCriticalSectionDeleteCri 阅读全文

posted @ 2018-10-08 11:38 priarieNew 阅读(476) 评论(0) 推荐(0)

C/C++ 信号量 CreateSemaphore 用法

摘要: #include "stdafx.h"#include <Windows.h>DWORD WINAPI Thread_1(LPVOID param);DWORD WINAPI Thread_2(LPVOID param);DWORD WINAPI Thread_3(LPVOID param);HAN 阅读全文

posted @ 2018-10-08 11:36 priarieNew 阅读(21696) 评论(1) 推荐(0)

枚举进程,线程,堆 CreateToolhelp32Snapshot

摘要: Takes a snapshot of the processes and the heaps, modules, and threads used by the processes.对当前系统进行一个快照。函数定义:HANDLE WINAPI CreateToolhelp32Snapshot( D 阅读全文

posted @ 2018-10-08 11:34 priarieNew 阅读(825) 评论(0) 推荐(0)

C/C++操作SQLite

摘要: 最近几天在学习sqlite3,颇有点收获,下面介绍一下简单用法:1.先下载sqlite3.h和sqlite3.c(如果不知道怎么下载的话就去www.sqlite.org)如果要编译成lib。则需要用到sqlite3.def 文件。具体要把sqlite3.def放到我们vs安装目录的的bin目录下。利 阅读全文

posted @ 2018-10-08 08:28 priarieNew 阅读(6043) 评论(0) 推荐(0)

SQL Server日常积累

摘要: 1: 在Sql Server 中增加一列语句: alter table table_name add column_name [not null] [references ....] 例如在表Major中增加名为AcademicId的一列,设置为不为空,并且设置为外键引用表AcademicId: a 阅读全文

posted @ 2018-10-08 08:24 priarieNew 阅读(246) 评论(0) 推荐(0)

导航