1.4. Error Handling

Most functions in the 32-bit API return error status in two different ways. Many functions return the first indication of an error in the return value for the function. For example, the RemoveDirectory function in Chapter 4 is typical:

RemoveDirectoryRemoves an empty directory
BOOL RemoveDirectory(
   LPTSTR dirName)
DirNameName/path of the directory to remove
Returns TRUE on success 

The RemoveDirectory function returns a boolean value that is TRUE if the function was successful and FALSE otherwise. Other functions return a specific value to indicate an error:

OpenService Opens a connection to the specified service
SC_HANDLE OpenService(
   SC_HANDLE scm,
   LPCTSTR name,
   DWORD access)
scmA handle to the SCM from OpenSCManager ...

Get Win32 System Services: The Heart of Windows® 98 and Windows® 2000 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.