Known Issue: DsRoleGetPrimaryDomainInformation returns an Error 2 - ERROR_FILE_NOT_FOUND even though the call was successful and the data was populated (Windows 10 SDK (14393) and tools, August 2016 release) RRS feed

  • Question

  • If your app uses the DsRoleGetPrimaryDomainInformation to retrieve the state data of the computer which includes the directory service installation and domain data, you may observe that calling this API on Windows 10, version 1607 (aka the Windows 10 Anniversary Update) may return an error 2 (ERROR_FILE_NOT_FOUND) even though the call was successful.

    This may happen when the app calls DsRoleGetPrimaryDomainInformation with the DsRolePrimaryDomainInfoBasic level parameter against a remote machine that is running Windows 10, version 1607 that is not a member of a domain nor part of a cluster.

    The observed symptom is that the API retrieves the information successfully by allocating and populating the buffer as the third parameter as would be expected when the call succeeds, but instead of returning an ERROR_SUCCESS, it returns an ERROR_FILE_NOT_FOUND.

    Monday, August 8, 2016 5:37 PM


  • This is a Known issue on Windows 10, version 1607. To workaround this issue, if your app encounters the above scenario, then the app may validate and consume the returned buffer as part of the when ERROR_FILE_NOT_FOUND is the return code of the API. More importantly, your app also needs to ensure that the return buffer is freed at a later point of in time by calling DsRoleFreeMemory to avoid running into memory leak symptoms.
    Monday, August 8, 2016 5:38 PM