📄 nscstiu.h
字号:
/*******************************************************************************
* @doc
*
* @module NSCStiU.H |
*
* This module contains common includes, GUID definitions,
* extern declarations, utility classes and DLL specific COM
* interfaces
*
* Copyright (c) National Semiconductor Corporation 1999-2000
* All rights reserved
*
******************************************************************************/
#include <windows.h>
#pragma intrinsic(memcmp,memset)
#include <objbase.h>
#include <stdio.h>
#include <stdarg.h>
#include <devioctl.h>
#include <usbscan.h>
#include "sti.h"
#include "stierr.h"
#include "stiusd.h"
#if !defined(DLLEXPORT)
#define DLLEXPORT __declspec( dllexport )
#endif
/*******************************************************************************
*
* Class IID's
*
******************************************************************************/
#if defined( _WIN32 ) && !defined( _NO_COM)
// The NULL guid which can be compared against function returns
// for invalid guid values - no valid entity should be identified
// by this guid
DEFINE_GUID(GUID_NULL, 0L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
// Guids for the events that can be fired by the scanner
// {2DA39CE1-4F33-11d3-9859-00104BF5E7FA}
DEFINE_GUID(guidEvent1,
0x2da39ce1, 0x4f33, 0x11d3, 0x98, 0x59, 0x0, 0x10, 0x4b, 0xf5, 0xe7, 0xfa);
// {2DA39CE2-4F33-11d3-9859-00104BF5E7FA}
DEFINE_GUID(guidEvent2,
0x2da39ce2, 0x4f33, 0x11d3, 0x98, 0x59, 0x0, 0x10, 0x4b, 0xf5, 0xe7, 0xfa);
// {2DA39CE3-4F33-11d3-9859-00104BF5E7FA}
DEFINE_GUID(guidEvent3,
0x2da39ce3, 0x4f33, 0x11d3, 0x98, 0x59, 0x0, 0x10, 0x4b, 0xf5, 0xe7, 0xfa);
// This GUID must match that use in the .inf file for this device.
// {D5B5A161-F125-11d2-90D2-00104BF5E7FA}
// {6bdd1fc6-810f-11d0-bec7-08002be2092f}
DEFINE_GUID(CLSID_NSCStiUObj, 0xD5B5A161, 0xF125, 0x11d2, 0x90, 0xd2, 0x00, 0x10, 0x4b, 0xf5, 0xe7, 0xfa);
#endif
#define DATASEG_PERINSTANCE ".instance"
#define DATASEG_SHARED ".shared"
#define DATASEG_READONLY ".code"
#define DATASEG_DEFAULT DATASEG_SHARED
#pragma data_seg(DATASEG_PERINSTANCE)
// Set the default data segment
#pragma data_seg(DATASEG_DEFAULT)
//
// Module ref counting
//
extern UINT g_cRefThisDll;
extern UINT g_cLocks;
extern HINSTANCE g_hInst;
extern BOOL DllInitializeCOM(void);
extern BOOL DllUnInitializeCOM(void);
extern void DllAddRef(void);
extern void DllRelease(void);
//
// Auto critical section clss
//
class CRIT_SECT
{
public:
void Lock() {EnterCriticalSection(&m_sec);}
void Unlock() {LeaveCriticalSection(&m_sec);}
CRIT_SECT() {InitializeCriticalSection(&m_sec);}
~CRIT_SECT() {DeleteCriticalSection(&m_sec);}
CRITICAL_SECTION m_sec;
};
class TAKE_CRIT_SECT
{
private:
CRIT_SECT& _syncres;
public:
inline TAKE_CRIT_SECT(CRIT_SECT& syncres) : _syncres(syncres) { _syncres.Lock(); }
inline ~TAKE_CRIT_SECT() { _syncres.Unlock(); }
};
//
// Base class for supporting non-delegating IUnknown for contained objects
//
struct INonDelegatingUnknown
{
// *** IUnknown-like methods ***
STDMETHOD(NonDelegatingQueryInterface)( THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,NonDelegatingAddRef)(THIS) PURE;
STDMETHOD_(ULONG,NonDelegatingRelease)( THIS) PURE;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -