Also, RPCSS_NPConnect() returns a file handle so treat it as such by checking it against INVALID_HANDLE_VALUE and not NULL.