共用设备时驱动返回GetLastError :5如何解决
共用设备时驱动返回GetLastError :5怎么解决
两个DLL(A/B)同时调用一个设备驱动C,且应用程式C同时调用A/B两个DLL时,驱动的CREATEFILE返回GETLASTERROR 5,而单独调用每一个都没有问题。驱动程序和DLL,及应用程式都可以改,但不知道要怎么改,请指点,谢谢!我没有多少分,请各大侠帮忙
------解决思路----------------------
应用程序在调用A/B时加锁。
Synchronization Functions
The following functions are used in synchronization.
CancelWaitableTimer
CreateEvent
CreateMutex
CreateSemaphore
CreateWaitableTimer
DeleteCriticalSection
EnterCriticalSection
GetOverlappedResult
InitializeCriticalSection
InitializeCriticalSectionAndSpinCount
InterlockedCompareExchange
InterlockedDecrement
InterlockedExchange
InterlockedExchangeAdd
InterlockedIncrement
LeaveCriticalSection
MsgWaitForMultipleObjects
MsgWaitForMultipleObjectsEx
OpenEvent
OpenMutex
OpenSemaphore
OpenWaitableTimer
PulseEvent
QueueUserAPC
ReleaseMutex
ReleaseSemaphore
ResetEvent
SetCriticalSectionSpinCount
SetEvent
SetWaitableTimer
SignalObjectAndWait
TimerAPCProc
TryEnterCriticalSection
WaitForMultipleObjects
WaitForMultipleObjectsEx
WaitForSingleObject
WaitForSingleObjectEx
《Windows核心编程》
------解决思路----------------------
在iocreatedevive的地方改
------解决思路----------------------
多半是驱动不支持同时被多次打开。A/B两个库的功能合并成1个库吧,这样设备驱动只需打开一次,不然恐怕无解。
或者修改A和B库,不要在A/B内打开设备,而是用C来打开设备,然后把设备对象(句柄)传给A和B
两个DLL(A/B)同时调用一个设备驱动C,且应用程式C同时调用A/B两个DLL时,驱动的CREATEFILE返回GETLASTERROR 5,而单独调用每一个都没有问题。驱动程序和DLL,及应用程式都可以改,但不知道要怎么改,请指点,谢谢!我没有多少分,请各大侠帮忙
------解决思路----------------------
应用程序在调用A/B时加锁。
Synchronization Functions
The following functions are used in synchronization.
CancelWaitableTimer
CreateEvent
CreateMutex
CreateSemaphore
CreateWaitableTimer
DeleteCriticalSection
EnterCriticalSection
GetOverlappedResult
InitializeCriticalSection
InitializeCriticalSectionAndSpinCount
InterlockedCompareExchange
InterlockedDecrement
InterlockedExchange
InterlockedExchangeAdd
InterlockedIncrement
LeaveCriticalSection
MsgWaitForMultipleObjects
MsgWaitForMultipleObjectsEx
OpenEvent
OpenMutex
OpenSemaphore
OpenWaitableTimer
PulseEvent
QueueUserAPC
ReleaseMutex
ReleaseSemaphore
ResetEvent
SetCriticalSectionSpinCount
SetEvent
SetWaitableTimer
SignalObjectAndWait
TimerAPCProc
TryEnterCriticalSection
WaitForMultipleObjects
WaitForMultipleObjectsEx
WaitForSingleObject
WaitForSingleObjectEx
《Windows核心编程》
------解决思路----------------------
在iocreatedevive的地方改
------解决思路----------------------
多半是驱动不支持同时被多次打开。A/B两个库的功能合并成1个库吧,这样设备驱动只需打开一次,不然恐怕无解。
或者修改A和B库,不要在A/B内打开设备,而是用C来打开设备,然后把设备对象(句柄)传给A和B