-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwlcomp.cpp
104 lines (87 loc) · 2.11 KB
/
wlcomp.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include <initguid.h>
#include "stubs.h"
#include "ioctl.h"
#include "ifc_ldev.h"
#include <cassert>
#include "wlcomp.h"
extern "C" LUnknown* CreateInstance(ULONG Slot);
LDevice* CreateLDevice(unsigned int Slot, unsigned int* err)
{
LUnknown* pIUnknown = CreateInstance(Slot);// pointer to interface
if(!pIUnknown) {
//CallCreateInstance failed
*err = GetLastError();
return 0;
}
IDaqLDevice* pI;
HRESULT hr = pIUnknown->QueryInterface(IID_ILDEV,(void**)&pI);
if(hr != S_OK) {
//IDaqLDevice failed
pIUnknown->Release();
*err = L_ERROR;
return 0;
}
pIUnknown->Release();
*err = L_SUCCESS;
return (LDevice*)pI;
}
void ReleaseLDevice(LDevice* hIfc)
{
assert(hIfc);
((IDaqLDevice*)hIfc)->Release();
}
unsigned int PlataTest(LDevice* hIfc)
{
assert(hIfc);
return ((IDaqLDevice*)hIfc)->PlataTest();
}
unsigned int OpenLDevice(LDevice* hIfc)
{
assert(hIfc);
HANDLE handle = ((IDaqLDevice*)hIfc)->OpenLDevice();
if (handle == INVALID_HANDLE_VALUE)
{
return L_ERROR;
}
return L_SUCCESS;
}
unsigned int CloseLDevice(LDevice* hIfc)
{
assert(hIfc);
return ((IDaqLDevice*)hIfc)->CloseLDevice();
}
unsigned int InitStartLDevice(LDevice* hIfc)
{
assert(hIfc);
return ((IDaqLDevice*)hIfc)->InitStartLDevice();
}
unsigned int StartLDevice(LDevice* hIfc)
{
assert(hIfc);
return ((IDaqLDevice*)hIfc)->StartLDevice();
}
unsigned int StopLDevice(LDevice* hIfc)
{
assert(hIfc);
return ((IDaqLDevice*)hIfc)->StopLDevice();
}
unsigned int LoadBios(LDevice* hIfc, char* FileName)
{
assert(hIfc);
return ((IDaqLDevice*)hIfc)->LoadBios(FileName);
}
unsigned int IoAsync(LDevice* hIfc, WASYNC_PAR* sp)
{
assert(hIfc);
return ((IDaqLDevice*)hIfc)->IoAsync(reinterpret_cast<ASYNC_PAR*>(sp));
}
unsigned int GetSlotParam(LDevice* hIfc, SLOT_PAR* slPar)
{
assert(hIfc);
return ((IDaqLDevice*)hIfc)->GetSlotParam(slPar);
}
unsigned int EnableCorrection(LDevice* hIfc, unsigned short Enabled)
{
assert(hIfc);
return ((IDaqLDevice*)hIfc)->EnableCorrection(Enabled);
}