Sample Code

Windows Driver Samples/ Toaster Sample Driver/ C++/ umdf/ func/ WUDFToaster.cpp/

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
85
86
87
88
/*++
 
  Copyright (c) Microsoft Corporation, All Rights Reserved
 
  Module Name:
 
    WUDFToaster.cpp
 
  Abstract:
 
    Implementation of DLL Exports.
 
  Environment:
 
    Windows User-Mode Driver Framework (WUDF)
 
--*/
 
#include "stdafx.h"
#include "resource.h"
 
#include "WUDFToaster.h"
 
#include "internal.h"
#include "WUDFToaster.tmh"
  
const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
 
class CToasterDriverModule : public CAtlDllModuleT< CToasterDriverModule >
{
public :
    DECLARE_LIBID(LIBID_WUDFToasterLib)
};
 
CToasterDriverModule _AtlModule;
 
// DLL Entry Point
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
    hInstance;
 
    if(dwReason == DLL_PROCESS_ATTACH)
    {
        //
        // Initialize tracing.
        //
 
        WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
    }
    else if(dwReason == DLL_PROCESS_DETACH)
    {
        //
        // Cleanup tracing.
        //
 
        WPP_CLEANUP();
    }
     
    return _AtlModule.DllMain(dwReason, lpReserved);
}
 
// Returns a class factory to create an object of the requested type
_Check_return_
STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv)
{
    return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
}
 
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
    return _AtlModule.DllCanUnloadNow();
}
 
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
    // registers object, typelib and all interfaces in typelib
    HRESULT hr = _AtlModule.DllRegisterServer();
    return hr;
}
 
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
    HRESULT hr = _AtlModule.DllUnregisterServer();
    return hr;
}

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