| Previous | Next |
| ERROR_NOT_CONTAINER | ERROR_INVALID_GROUPNAME |
ERROR_EXTENDED_ERROR
Meaning and context of ERROR_EXTENDED_ERROR
The WNet functions return error codes for compatibility with Windows for Workgroups. Each WNet function also sets the error code value returned by GetLastError.
When one of the WNet functions returns ERROR_EXTENDED_ERROR (1208), an application can call the WNetGetLastError function to retrieve additional information about the error. This information is usually specific to the network provider.
The following example illustrates an application-defined error-handling function (NetErrorHandler). The function takes three arguments: a window handle, the error code returned by one of the WNet functions, and the name of the function that produced the error. If the error code is ERROR_EXTENDED_ERROR, NetErrorHandler calls WNetGetLastError to get extended error information and prints the information. The sample calls the MessageBox function to process messages.
#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "mpr.lib")
#pragma comment(lib, "user32.lib")
BOOL WINAPI NetErrorHandler(HWND hwnd,
DWORD dwErrorCode,
LPSTR lpszFunction)
{
DWORD dwWNetResult, dwLastError;
CHAR szError[256];
CHAR szCaption[256];
CHAR szDescription[256];
CHAR szProvider[256];
// The following code performs standard error-handling.
if (dwErrorCode != ERROR_EXTENDED_ERROR)
{
sprintf_s(
(LPSTR)szError
, sizeof(szError)
, "%s failed; \\nResult is %ld"
, lpszFunction
, dwErrorCode
);
sprintf_s((LPSTR) szCaption, sizeof(szCaption), "%s error", lpszFunction);
MessageBox(hwnd, (LPSTR) szError, (LPSTR) szCaption, MB_OK);
return TRUE;
}
// The following code performs error-handling when the
// ERROR_EXTENDED_ERROR return value indicates that the
// WNetGetLastError function can retrieve additional information.
else
{
dwWNetResult = WNetGetLastError(&dwLastError, // error code
(LPSTR) szDescription, // buffer for error description
sizeof(szDescription), // size of error buffer
(LPSTR) szProvider, // buffer for provider name
sizeof(szProvider)); // size of name buffer
//
// Process errors.
//
if(dwWNetResult != NO_ERROR) {
sprintf_s((LPSTR) szError, sizeof(szError),
"WNetGetLastError failed; error %ld", dwWNetResult);
MessageBox(hwnd, (LPSTR) szError, "WNetGetLastError", MB_OK);
return FALSE;
}
//
// Otherwise, print the additional error information.
//
sprintf_s((LPSTR) szError, sizeof(szError),
"%s failed with code %ld;\\n%s",
(LPSTR) szProvider, dwLastError, (LPSTR) szDescription);
sprintf_s((LPSTR) szCaption, sizeof(szCaption), "%s error", lpszFunction);
MessageBox(hwnd, (LPSTR) szError, (LPSTR) szCaption, MB_OK);
return TRUE;
}
}
Where ERROR_EXTENDED_ERROR is returned
ERROR_EXTENDED_ERROR is Win32 system error 1208 (0x000004B8) from winerror.h. AllStat describes it as “An extended error has occurred.”. For ERROR_EXTENDED_ERROR, the code is useful only together with the API that failed, because multiple Windows components can reuse system-error values while imposing different retry and cleanup rules.
Diagnostic sequence for ERROR_EXTENDED_ERROR
- Call GetLastError immediately after the failing API and save ERROR_EXTENDED_ERROR, the function name, all relevant flags, and the target path, handle, service, device, account, or policy object.
- Capture the component log that owns the extended operation and retain the original numeric value before a framework converts it to an HRESULT or exception.
- For ERROR_EXTENDED_ERROR, compare preconditions with the API documentation and reproduce with a minimal request before changing system-wide configuration.
Retry ERROR_EXTENDED_ERROR only after the resource or state named in “An extended error has occurred.” has changed. For ERROR_EXTENDED_ERROR, for invalid parameters, unsupported formats, missing objects, policy restrictions, and access failures, correct the input or configuration instead of immediately repeating the same call.
Official references for ERROR_EXTENDED_ERROR
Looking for a different code? Search another status or error code.