Sample Code

Windows Driver Samples/ ObCallback Callback Registration Driver/ C++/ control/ common.h/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Notice:
//
//    Use this sample code at your own risk; there is no support from Microsoft for the sample code.
//    In addition, this sample code is licensed to you under the terms of the Microsoft Public License
 
#pragma once
 
#pragma warning (disable: 4201) // nonstandard extension used : nameless struct/union
 
#include "..\driver\shared.h"
 
//
// Logging support macros.
//
// LOG_INFO
// LOG_INFO_FAILURE
// LOG_PASSED
// LOG_ERROR
//
 
 
#ifdef DEBUG
#define LOG_INFO(fmt, ...)         \
    _tprintf(_T("%hs: ") fmt, __FUNCTION__, __VA_ARGS__);_tprintf(_T("\n"));
#define LOG_INFO_FAILURE(fmt, ...) \
    _tprintf(_T("ReportFailure %hs: ") fmt, __FUNCTION__, __VA_ARGS__);_tprintf(_T("\n"));
 
#define LOG_PASSED(fmt, ...)       \
    _tprintf(_T("\n!!!PASSED: %hs (%hs:%u): ") fmt, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__);_tprintf(_T("\n"));
#define LOG_ERROR(fmt, ...)        \
    _tprintf(_T("\n!!!FAILED: %hs (%hs:%u): ") fmt, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__); _tprintf(_T("\n"));
 
#else
 
#define LOG_INFO(FormatString, ...)   
#define LOG_INFO_FAILURE(FormatString, ...)
 
#define LOG_PASSED(FormatString, ...)     
#define LOG_ERROR(FormatString, ...)  
 
#endif
 
 
extern HANDLE TcDeviceHandle;
 
BOOL TcInitialize();
BOOL TcUnInitialize();
BOOL TcCleanupSCM();
 
BOOL TcInstallDriver();
 
BOOL TcUninstallDriver();
 
BOOL TcRemoveProtection ();
 
BOOL TcProcessName (
    _In_ int argc,
    _In_reads_(argc) LPCWSTR argv[],
    _In_ ULONG ulOperation
);
 
BOOL TcUnprotectCallback ();
 
BOOL TcProcessNameCallback (
    _In_reads_(NAME_SIZE+1) PCWSTR  pnametoprotect,
    _In_ ULONG ulOperation
);
 
//
// Utility functions
//
 
BOOL TcInitializeGlobals();
BOOL TcLoadDriver();
BOOL TcUnloadDriver();
 
BOOL TcCreateService();
BOOL TcDeleteService();
BOOL TcStartService();
BOOL TcStopService();
 
BOOL TcOpenDevice();
BOOL TcCloseDevice();

Our Services

  • What our customers say about us?

© 2011-2025 All Rights Reserved. Joya Systems. 4425 South Mopac Building II Suite 101 Austin, TX 78735 Tel: 800-DEV-KERNEL

Privacy Policy. Terms of use. Valid XHTML & CSS