What's the most annoying api you've ever used?
 
Mine pretty much has to be the winsock NSP as it is probably the hardest api in Windows to use
behind the relatively harmless looking
 
INT WSALookupServiceBegin(
  LPWSAQUERYSET pQuerySet,
  DWORD dwFlags,
  LPHANDLE lphLookup
);
 
lay 10 pointers of PAIN! (in the first level alone!)
 
typedef struct _WSAQuerySet {
  DWORD 
dwSize;
  LPTSTR 
lpszServiceInstanceName;
  LPGUID 
lpServiceClassId;
  LPWSAVERSION 
lpVersion;
  LPTSTR 
lpszComment;
  DWORD 
dwNameSpace;
  LPGUID 
lpNSProviderId;
  LPTSTR 
lpszContext;
  DWORD 
dwNumberOfProtocols;
  LPAFPROTOCOLS 
lpafpProtocols;
  LPTSTR 
lpszQueryString;
  DWORD 
dwNumberOfCsAddrs;
  LPCSADDR_INFO 
lpcsaBuffer;
  DWORD 
dwOutputFlags;
  LPBLOB 
lpBlob;
} WSAQUERYSET, 
 
Needless to say its pretty difficult to use (and even harder to get to work with C#) but it does try to cover a lot of different types of name resolution and other network events (Bluetooth,PNRP,NLA,DNS,SAP,WINS,X500,NETBT). But that doesn’t make it anymore fun to use:)
 
What's your nightmare?