Jump to content

UsbDeregisterNotification: Difference between revisions

From EDM2
W.m.brul (talk | contribs)
added example code
W.m.brul (talk | contribs)
Line 35: Line 35:
{
{
   ulrc = UsbDeregisterNotification(NotifyID);
   ulrc = UsbDeregisterNotification(NotifyID);
   printf("\nUsbDeregisterNotification - ulrc: [%04X] (%hu)",ulrc,ulrc);
   printf("\nUsbDeregisterNotification - ulrc&colon. 0x%04X (%hu)",ulrc,ulrc);


   //release semaphores
   //release semaphores
   ulrc = DosCloseEventSem(hDeviceAdded);
   ulrc = DosCloseEventSem(hDeviceAdded);
   printf("\nDosCloseEventSem - ulrc: [%04X] (%hu)",ulrc,ulrc);
   printf("\nDosCloseEventSem - ulrc&colon. 0x%04X (%hu)",ulrc,ulrc);
   ulrc = DosCloseEventSem(hDeviceRemoved);
   ulrc = DosCloseEventSem(hDeviceRemoved);
   printf("\nDosCloseEventSem - ulrc: [%04X] (%hu)",ulrc,ulrc);
   printf("\nDosCloseEventSem - ulrc&colon. 0x%04X (%hu)",ulrc,ulrc);
}
}
</pre>
</pre>

Revision as of 16:14, 10 February 2017

Description

Removes the registration of attach/detach notification semaphores.

Syntax

ulrc = UsbDeregisterNotification(NotifyID)

Parameters

NotifyID
the NotifyID received from UsbChangeNotification or UsbDeviceNotification.

Return Code

0x0000 - NO_ERROR

Errors

0x0006 - ERROR_INVALID_HANDLE
0x001F - ERROR_GEN_FAILURE
0x0057 - ERROR_INVALID_PARAMETER
0x005F - ERROR_INTERRUPT
0x0064 - ERROR_TOO_MANY_SEMAPHORES
0x0067 - ERROR_TOO_MANY_SEM_REQUESTS
0x0069 - ERROR_SEM_OWNER_DIED
0x1B58 - USB_NOT_INIT
0xFF1F - ERROR_GEN_FAILURE
0xFF57 - ERROR_INVALID_PARAMETER
0xFFBB - ERROR_SEM_NOT_FOUND

Remarks

Example Code

//Code Snippet - UsbDeregisterNotification
{
  ulrc = UsbDeregisterNotification(NotifyID);
  printf("\nUsbDeregisterNotification - ulrc&colon. 0x%04X (%hu)",ulrc,ulrc);

  //release semaphores
  ulrc = DosCloseEventSem(hDeviceAdded);
  printf("\nDosCloseEventSem - ulrc&colon. 0x%04X (%hu)",ulrc,ulrc);
  ulrc = DosCloseEventSem(hDeviceRemoved);
  printf("\nDosCloseEventSem - ulrc&colon. 0x%04X (%hu)",ulrc,ulrc);
}

Related Functions