前言,本篇文章主要记录各种常用的代码格式。这些代码格式是方便创建空白文件时,减少一些重复的代码拼写。

驱动代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <ntddk.h>

void DriverUnload(PDRIVER_OBJECT pDriverObject);

NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegPath)
{
DbgPrint("Hello World!\n");

pDriverObject->DriverUnload = DriverUnload;
return STATUS_SUCCESS;
}

void DriverUnload(PDRIVER_OBJECT pDriverObject)
{
DbgPrint("Bye!\n");
}

VC6下的StdAfx.h头文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#if !defined(AFX_STDAFX_H__6C695132_E998_4352_A65E_EA4EB7B8E75A__INCLUDED_)
#define AFX_STDAFX_H__6C695132_E998_4352_A65E_EA4EB7B8E75A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers

#include <stdio.h>

// TODO: reference additional headers your program requires here

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__6C695132_E998_4352_A65E_EA4EB7B8E75A__INCLUDED_)