ISAPI-Filter

Wie schon erwähnt, sind bei einer ordentlichen Implementierung drei Funktionen zu exportieren.

GetFilterVersion:

In dieser Funktion ist ein Record zu füllen, mit der Versionsnummer, einer Beschreibung und am wichtigsten den Flags.
Die Flags zeigen dem Webserver an, welche Events (Notifications) siehe Tabelle 1, vom ISAPI-Filter bearbeitet werden.

HttpFilterProc:

Diese Funktion bearbeitet alle Events (Notifications) siehe Tabelle 1, es ist darauf zu achten, dass am Ende im Normal-Fall der Result - Wert auf SF_STATUS_REQ_NEXT_NOTIFICATION steht, falls die Bearbeitung im Filter nicht komplett erledigt wurde! Zu den einzelnen Notifications komme ich später.

TerminateFilter:

In dieser Funktion ist grundsätzlich erst einmal nichts erforderlich, außer eine positive Rückmeldung an den Server zu senden.

Notifications

Für quasi jedes Event, was im Webserver ausgelöst wird, gibt es eine Einsprungmöglichkeit zum Überarbeiten oder um die Arbeit selbst zu übernehmen. Fangen wir mit einem der Interessantesten an SF_NOTIFY_PREPROC_HEADERS, hier stehen alle Informationen bezüglich eines Requests zur Verfügung, die dann bearbeitet oder ergänzt werden können, um dann vom Webserver weiter ausgeführt werden zu können, also die klassische Möglichkeit um einen URL-Rewriter zu erzeugen.

Da ich, wie ich schon erwähnt habe, mehr auf objektorientierte Programmierung stehe, hier wieder nur ein kleines Beispiel, aber eines, was man zum Auffinden von Fehlern in einem Webauftritt gut benutzen kann, dieses Filter schreibt die Request Header von fehlerhaften Seitenaufrufen in einem Logfile. Aber das Beste kommt noch, falls der Application Pool auf dem IIS hängt dann wird er von diesem Filter neu gestartet, dafür wird allerdings noch ein kleines Programm RecycleAppPool.exe benötigt!

hang_Filter.lpr Pascal (12,33 kByte) 23.02.2014 14:45
// *****************************************************************************
//  Title.............. :  Hang ISAPI Filter
//
//  Modulname ......... :  hang_filter.lpr (ISAPI-DLL)
//  Type .............. :  Lazarus Project File
//  Author ............ :  Udo Schmal
//  Development Status  :  23.02.2014
//  Operating System .. :  Win32
//  IDE ............... :  Lazarus
// *****************************************************************************
library hangFilter;
{$mode objfpc}{$H+}
{$R hang_Filter.res}

uses
  Windows, SysUtils, Classes, DateUtils, isapi, GMTUtils, StatusUtils;

type
  PItem = ^TItem;
  TItem = record
    Previous, Next: PItem;
    Host, Url, RequestHeader: string;
    Time: TDateTime;
    Length: integer;
  end;

var
  LoggingLock, ReqLock: TRTLCriticalSection;
  root, LogFile, dllPath: string;
  RecycleAppPoolTimeout: integer;
  bRecycleAppPool: boolean;
  LastRequest: integer;
  Head, Tail: PItem;

procedure Log(sLine: string; bTime: boolean = true);
var
  f: textfile;
  fn: string;
begin
  EnterCriticalSection(LoggingLock);
  try
    fn := LogFile + FormatDateTime('dd"."mm"."yyyy', Now) + '.log';
{$I-}
    AssignFile(f, fn);
    if FileExists(fn) then
      Append(f)
    else
      ReWrite(f);
    if bTime then Write(f, FormatDateTime('hh:nn:ss:zzz"|"', Now));
    Writeln(f, StringReplace(sLine, #13#10, #13#10'            | ', [rfReplaceAll]));
    CloseFile(f);
    IOResult;
{$I+}
  finally
    LeaveCriticalSection(LoggingLock);
  end;
end;

function CreateFilterContext(const Host, Url, RequestHeader: string): PItem;
begin
  EnterCriticalSection(ReqLock);
  try
    New(Result);
    result^.Host := Host;
    result^.Url := Url;
    result^.RequestHeader := RequestHeader;
    result^.Time := Now();
    result^.Length := 0;
    result^.Previous := Tail^.Previous;
    result^.Next := Tail;
    Tail^.Previous^.Next := result;
    Tail^.Previous := result;
  finally
    LeaveCriticalSection(ReqLock);
  end;
end;

procedure DestroyFilterContext(const Item: PItem);
begin
  EnterCriticalSection(ReqLock);
  try
    Item^.Previous^.Next := Item^.Next;
    Item^.Next^.Previous := Item^.Previous;
    Item^.Previous := nil;
    Item^.Next := nil;
    Dispose(Item);
  finally
    LeaveCriticalSection(ReqLock);
  end;
end;

function RunAs(const Filename, Param, Username, Password: string): DWORD;
var
  hLogon: THandle;
  s: WideString;
  si: TStartupInfo;
  pi: TProcessInformation;
begin
  SetLastError(0);
  if not LogonUser(PChar(Username), nil, PChar(Password), LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, hLogon) then
  begin
    result := GetLastError;
    Log('RunAs Admin ... LogonUser failed.');
  end
  else
  begin
    ZeroMemory(@si, sizeof(si));
    si.cb := sizeof(si);
    ZeroMemory(@pi, sizeof(pi));
    s := WideString(Filename) + WideString(' "') + WideString(Param) + WideString('"');
    if CreateProcessAsUserW(hLogon, nil, PWideChar(s), nil, nil, False, CREATE_DEFAULT_ERROR_MODE + HIGH_PRIORITY_CLASS, nil, nil, @si, @pi) then
      result := 0
    else
    begin
      Log('RunAs Admin CreateProcess failed.');
      result := GetLastError;
    end;
    CloseHandle(hLogon);
    ZeroMemory(@Password[1], length(Password));
  end;
end;

procedure ForceTermination();
var Item: PItem;
begin
  bRecycleAppPool := true;

  Item := Head^.Next;
  while Item <> Tail do
  begin
    Log(Item^.Host + Item^.Url +
      #13#10'* Requested at: ' + FormatDateTime('hh:nn:ss:zzz', Item^.Time) +
      #13#10'* RequestHeader:' +
      #13#10'* ' + StringReplace(Item^.RequestHeader, #13#10, #13#10'* ', [rfReplaceAll]));
    Item := Item^.Next;
  end;

  RunAs(dllPath + 'RecycleAppPool.exe', 'DefaultAppPool', 'Administrator', '12345678');
end;

function ExtractUrl(const AUrl: string): string;
begin
  result := AUrl;
  if (pos('?', result)>0) then
    SetLength(result, pos('?', result)-1);
  if (pos('#', result)>0) then
    SetLength(result, pos('#', result)-1);
  if (pos('://', result)>0) then
  begin
    result := Copy(result, pos('://', result)+3);
    result := Copy(result, pos('/', result));
  end;
end;

function ExtractUrlPath(const AUrl: string): string;
begin
  result := ExtractUrl(AUrl);
  if LastDelimiter('/', result)>1 then
    SetLength(result, LastDelimiter('/', result))
  else
    result := '/';
end;

function ExtractUrlFilename(const AUrl: string): string;
begin
  result := ExtractUrl(AUrl);
  if LastDelimiter('/', result)<length(result) then
    result := copy(result, LastDelimiter('/', result)+1)
  else
    result := '';
end;

function ExtractUrlFileExtension(const AUrl: string): string;
begin
  result := ExtractUrlFilename(AUrl);
  result := ExtractFileExt(result);
end;

function GetFilterVersion(var Ver: THTTP_FILTER_VERSION): BOOL; stdcall;
begin
  Log('GetFilterVersion: ISAPI Filter is running!');
  Ver.dwFilterVersion := MakeLong(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);
  Ver.lpszFilterDesc := 'ISAPI Filter';
  Ver.dwFlags := SF_NOTIFY_PREPROC_HEADERS or SF_NOTIFY_LOG;
  result := true;
end;

function TerminateFilter(dwFlags: DWORD): BOOL; stdcall;
begin
  Log('TerminateFilter: ISAPI Filter terminating...');
  Integer(result) := 1; // This is so that the Apache web server will know what "True" really is
end;

function HttpFilterProc(var pfc: THTTP_FILTER_CONTEXT; NotificationType: DWORD;
                         pvNotification: pointer): DWORD; stdcall;

  function ServerVariables(const Name: string): string;
  var
    Buffer: array[0..4095] of Char;
    Size: DWORD;
  begin
    try
      Size := SizeOf(Buffer);
      if pfc.GetServerVariable(pfc, PChar(Name), @Buffer, Size) or
        pfc.GetServerVariable(pfc, PChar('HTTP_' + Name), @Buffer, Size) then  { do not localize }
      begin
        if Size > 0 then Dec(Size);
          SetString(result, Buffer, Size);
      end
      else
        result := '';
    except
      Log('Error in ServerVariables');
    end;
  end;

  function OnPreprocHeaders: integer;
  var PreprocHeader: PHTTP_FILTER_PREPROC_HEADERS;

    function GetHeaderValue(Name: string): string;
    var
      Buffer: array[0..4096] of char;
      lenBuffer : DWORD;
    begin
      result := '';
      try
        lenBuffer := SizeOf(Buffer);
//        FillChar(Buffer, lenBuffer, #0);
        if PreprocHeader^.GetHeader(pfc, PChar(Name), Buffer, lenBuffer) then
          result := Buffer;
      except
        Log('GetHeaderValue Error');
      end;
    end;

    procedure SetHeaderValue(Name: string; Value: string);
    begin
      try
        PreprocHeader^.SetHeader(pfc, PChar(Name), PChar(Value));
      except
        Log('SetHeaderValue Error');
      end;
    end;

    procedure AddHeaderValue(Name: string; Value: string);
    begin
      try
        PreprocHeader^.AddHeader(pfc, PChar(Name), PChar(Value));
      except
        Log('AddHeaderValue Error');
      end;
    end;

    function SendResponseHeader(status: string; const location: string = ''): integer;
    var
      str: string;
      Len: Cardinal;
    begin
      str := 'HTTP/1.1 ' + status + #13#10;
      if location<>'' then
        str := str + 'Location: ' + location + #13#10 ;
      str := str +
             'Server: ' + ServerVariables('SERVER_SOFTWARE') + #13#10 +
             'X-Powered-By: Hang ISAPI Filter, Udo Schmal'#13#10 +
             'Date: ' + NowGMTStr() + #13#10 +
             #13#10#0;
      Len := Length(str);
      if pfc.WriteClient(pfc, PChar(str), Len, 0) then
        result := SF_STATUS_REQ_FINISHED
      else
        result := SF_STATUS_REQ_ERROR;
    end;

    procedure Timeout();
    var
      sec: integer;
      ext: string;
      Item: PItem;
    begin
      Item := Head^.Next;
      if Item <> Tail then
      begin
        sec := SecondsBetween(Now, Item^.Time);
        ext := lowercase(ExtractUrlFileExtension(Item^.Url));
        if (sec>RecycleAppPoolTimeout) and (pos(',' + ext + ',', ',.htm,.html,.asp,.dll,')<>0) then
        begin
          Log(Item^.Host + Item^.Url + ' (' + ext + ' ' + IntToStr(sec) + 'Sec.) --> RecycleAppPool' +
              #13#10'Requested at: ' + FormatDateTime('hh:nn:ss:zzz', Item^.Time) +
              #13#10'Request Header:' +
              #13#10 + Item^.RequestHeader);
          DestroyFilterContext(Item);
          if not bRecycleAppPool then
            ForceTermination();
        end;
      end;
    end;

  var sHost, sUrl, sMethod, sRequestHeader, sExt: string;
  begin
    result := SF_STATUS_REQ_NEXT_NOTIFICATION;
    PreprocHeader := PHTTP_FILTER_PREPROC_HEADERS(pvNotification);
    sHost := ServerVariables('HTTP_HOST');
    sUrl := GetHeaderValue('url');
    sMethod := ServerVariables('HTTP_METHOD');
  
    sRequestHeader :=  sMethod + ' ' + sUrl + #13#10 + ServerVariables('ALL_RAW');
    pfc.pFilterContext := CreateFilterContext(sHost, sUrl, sRequestHeader);
    Timeout();

    sExt := Lowercase(ExtractUrlFileExtension(sUrl));
    if (result = SF_STATUS_REQ_NEXT_NOTIFICATION) and
      (pos(sExt, '.jpg.png.gif.txt.xml.js.css.ico.pdf.htc.zip.doc.ppt.xsl.swf.flv')=0) then
    begin
      if GetTickCount64-LastRequest<100 then
        Sleep(100-(GetTickCount64-LastRequest));
      LastRequest := GetTickCount64;
    end;
  end;

  function OnLog: integer;
  var
    FilterLog: PHTTP_FILTER_LOG;
    Item: PItem;
  begin
    Item := pfc.pFilterContext;
    FilterLog := PHTTP_FILTER_LOG(pvNotification);
    if (FilterLog^.dwHttpStatus=500) and not bRecycleAppPool then
    begin
      Log(Item^.Host + Item^.Url + ' (HTTPStatus: ' + IntToStr(FilterLog^.dwHttpStatus) + ') --> RecycleAppPool' +
          #13#10'HTTPStatus: ' + IntToStr(FilterLog^.dwHttpStatus) + ' ' + http_Status_Msg(FilterLog^.dwHttpStatus) +
          #13#10'Win32Status: '+ win32_Error_Msg(FilterLog^.dwWin32Status) +
          #13#10'Requested at: ' + FormatDateTime('hh:nn:ss:zzz', Item^.Time) +
          #13#10'Request Header:' +
          #13#10 + Item^.RequestHeader);
      ForceTermination();
    end
    else if (FilterLog^.dwHttpStatus<200) or (FilterLog^.dwHttpStatus>399) then
      Log(Item^.Host + Item^.Url +
          #13#10'HTTPStatus: ' + IntToStr(FilterLog^.dwHttpStatus) + ' ' + http_Status_Msg(FilterLog^.dwHttpStatus) +
          #13#10'Win32Status: '+ win32_Error_Msg(FilterLog^.dwWin32Status) +
          #13#10'Requested at: ' + FormatDateTime('hh:nn:ss:zzz', Item^.Time) +
          #13#10'Request Header:' +
          #13#10 + Item^.RequestHeader);
    DestroyFilterContext(pfc.pFilterContext);
    result := SF_STATUS_REQ_NEXT_NOTIFICATION;
  end;

//HttpFilterProc mainline code
begin
  result := SF_STATUS_REQ_NEXT_NOTIFICATION;
  if NotificationType = SF_NOTIFY_PREPROC_HEADERS then
    result := OnPreprocHeaders
  else if NotificationType = SF_NOTIFY_LOG then
    result := OnLog
  else
    result := SF_STATUS_REQ_NEXT_NOTIFICATION;
end;

exports GetFilterVersion, HttpFilterProc, TerminateFilter;

function ModuleFileName(): string;
var Buffer: array[0..MAX_PATH] of Char;
begin
  FillChar(Buffer, SizeOf(Buffer), #0);
  SetString(result, Buffer, GetModuleFileName(hInstance, Buffer, Length(Buffer)));
  if pos('\\?\', result) = 1 then
    result := copy(result, 5, MAX_PATH);
end;

function ParentDir(const sPath: string): string;
begin
  result := copy(sPath, 1, LastDelimiter(':\/', copy(sPath,1,length(sPath)-1)));
end;

var
  dllName: string;
  p, n: PItem;
initialization
  InitCriticalSection(LoggingLock);
  dllName := ModuleFileName();
  dllPath := ExtractFilePath(dllName);
  LogFile := ParentDir(dllPath) + 'logging\' + ChangeFileExt(ExtractFileName(dllName), '');
  root := ParentDir(dllPath) + 'www-root';

  Log('initialization ISAPI Filter!');
  if IsLibrary then Log('is library');
  if IsMultiThread then Log('is multithreaded');

  InitCriticalSection(ReqLock);

  bRecycleAppPool := false;
  RecycleAppPoolTimeout := 120;
  New(Head);
  New(Tail);
  Head^.Previous := nil;
  Head^.Next := Tail;
  Tail^.Previous := Head;
  Tail^.Next := nil;
  LastRequest := GetTickCount64;

finalization
  Log('finalization ISAPI Filter!');

  p := Head^.Next;
  while (p<>Tail) do
  begin
    n := p^.Next;
    Dispose(p);
    p := n;
  end;
  Dispose(Head);
  Dispose(Tail);

  DoneCriticalsection(LoggingLock);
  DoneCriticalSection(ReqLock);
end.
statusutils.pas Pascal (76,22 kByte) 23.02.2014 14:53
// *****************************************************************************
//  Title.............. :  Status Utils Unit
//
//  Modulname ......... :  StatusUtils.pas
//  Type .............. :  Unit
//  Author ............ :  Udo Schmal
//  Development Status  :  23.02.2014
//  Operating System .. :  Win32/Win64
//  IDE ............... :  Delphi & Lazarus
// *****************************************************************************
unit StatusUtils;
{$ifdef fpc}
  {$mode objfpc}
{$endif}
{$H+}

interface

uses SysUtils;

const
  HTTP_CONTINUE                        = 100; // Continue
  HTTP_SWITCHING_PROTOCOLS             = 101; // Switching Protocols
  HTTP_PROCESSING                      = 102; // Processing
  HTTP_OK                              = 200; // OK
  HTTP_CREATED                         = 201; // Created
  HTTP_ACCEPTED                        = 202; // Accepted
  HTTP_NON_AUTHORITATIVE_INFORMATION   = 203; // Non-Authoritative Information
  HTTP_NO_CONTENT                      = 204; // No Content
  HTTP_RESET_CONTENT                   = 205; // Reset Content
  HTTP_PARTIAL_CONTENT                 = 206; // Partial Content
  HTTP_MULTI_STATUS                    = 207; // Multi-Status
  HTTP_MULTIPLE_CHOICE                 = 300; // Multiple Choice
  HTTP_MOVED_PERMANENTLY               = 301; // Moved Permanently
  HTTP_MOVED_TEMPORARILY               = 302; // Found
  HTTP_SEE_OTHER                       = 303; // See Other
  HTTP_NOT_MODIFIED                    = 304; // Not Modified
  HTTP_USE_PROXY                       = 305; // Use Proxy
  HTTP_SWITCH_PROXY                    = 306; // Switch Proxy
  HTTP_TEMPORARY_REDIRECT              = 307; // Temporary Redirect
  HTTP_BAD_REQUEST                     = 400; // Bad Request
  HTTP_INVALID_DESTINATIOM_HEADER      = 400.1; // Invalid Destination Header.
  HTTP_INVALID_DEPTH_HEADER            = 400.2; // Invalid Depth Header.
  HTTP_INVALID_IF_HEADER               = 400.3; // Invalid If Header.
  HTTP_INVALID_OVERWRITE_HEADER        = 400.4; // Invalid Overwrite Header.
  HTTP_INVALID_TRANSLATE_HEADER        = 400.5; // Invalid Translate Header.
  HTTP_INVALID_REQUEST_BODY            = 400.6; // Invalid Request Body.
  HTTP_INVALID_CONTENT_LENGTH          = 400.7; // Invalid Content Length.
  HTTP_INVALID_TIMEOUT                 = 400.8; // Invalid Timeout.
  HTTP_INVALID_LOCK_TOKEN              = 400.9; // Invalid Lock Token.
  HTTP_UNAUTHORIZED                    = 401; // Unauthorized / Access denied
  HTTP_LOGON_FAILED                    = 401.1; // Logon failed.
  HTTP_LOGON_FAILED_DUE_TO_SERVER      = 401.2; // Logon failed due to server configuration.
  HTTP_UNAUTHORIZED_DUE_TO_ACL         = 401.3; // Unauthorized due to ACL on resource.
  HTTP_AUTHORIZATION_FAILED_BY_FILTER  = 401.4; // Authorization failed by filter.
  HTTP_AUTHORIZATION_FAILED_BY_APP     = 401.5; // Authorization failed by ISAPI/CGI application.
  HTTP_PAYMENT_REQUIRED                = 402; // Payment Required
  HTTP_FORBIDDEN                       = 403; // Forbidden
  HTTP_EXECUTE_ACCESS_FORBIDDEN        = 403.1; // Execute access forbidden.
  HTTP_READ_ACCESS_FORBIDDEN           = 403.2; // Read access forbidden.
  HTTP_WRITE_ACCESS_FORBIDDEN          = 403.3; // Write access forbidden.
  HTTP_SSL_REQUIRED                    = 403.4; // SSL required.
  HTTP_SSL_128_REQUIRED                = 403.5; // SSL 128 required.
  HTTP_IP_ADDRESS_REJECTED             = 403.6; // IP address rejected.
  HTTP_CLIENT_CERTIFICATE_REQUIRED     = 403.7; // Client certificate required.
  HTTP_SITE_ACCESS_DENIED              = 403.8; // Site access denied.
  HTTP_FORBIDDEN_TOO_MANY_CLIENTS      = 403.9; // Forbidden: Too many clients are trying to connect to the Web server.
//403.10; // Forbidden: Web server is configured to deny Execute access.
//403.11; // Forbidden: Password has been changed.
//403.12; // Mapper denied access.
//403.13; // Client certificate revoked.
//403.14; // Directory listing denied.
//403.15; // Forbidden: Client access licenses have exceeded limits on the Web server.
//403.16; // Client certificate is untrusted or invalid.
//403.17; // Client certificate has expired or is not yet valid.
//403.18; // Cannot execute requested URL in the current application pool.
//403.19; // Cannot execute CGI applications for the client in this application pool.
//403.20; // Forbidden: Passport logon failed.
//403.21; // Forbidden: Source access denied.
//403.22; // Forbidden: Infinite depth is denied.
  HTTP_NOT_FOUND                       = 404; // Not Found
//  404.0; // Not found.
//  404.1; // Site Not Found.
//  404.2; // ISAPI or CGI restriction.
//  404.3; // MIME type restriction.
//  404.4; // No handler configured.
//  404.5; // Denied by request filtering configuration.
//  404.6; // Verb denied.
//  404.7; // File extension denied.
//  404.8; // Hidden namespace.
//  404.9; // File attribute hidden.
//  404.10; // Request header too long.
//  404.11; // Request contains double escape sequence.
//  404.12; // Request contains high-bit characters.
//  404.13; // Content length too large.
//  404.14; // Request URL too long.
//  404.15; // Query string too long.
//  404.16; // DAV request sent to the static file handler.
//  404.17; // Dynamic content mapped to the static file handler via a wildcard MIME mapping.
  HTTP_METHOD_NOT_ALLOWED              = 405; // Method Not Allowed
  HTTP_NOT_ACCEPTABLE                  = 406; // Not Acceptable
  HTTP_PROXY_AUTHENTICATION_REQUIRED   = 407; // Proxy Authentication Required
  HTTP_REQUEST_TIMEOUT                 = 408; // Request Timeout
  HTTP_CONFLICT                        = 409; // Conflict
  HTTP_GONE                            = 410; // Gone
  HTTP_LENGTH_REQUIRED                 = 411; // Length Required
  HTTP_PRECONDITION_FAILED             = 412; // Precondition Failed
  HTTP_REQUEST_ENTITY_TOO_LARGE        = 413; // Request Entity Too Large
  HTTP_REQUEST_URI_TOO_LONG            = 414; // Request-URI Too Long
  HTTP_UNSUPPORTED_MEDIA_TYPE          = 415; // Unsupported Media Type
  HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416; // Requested range not satisfiable
  HTTP_EXPECTATION_FAILED              = 417; // Expectation Failed
  HTTP_IM_A_TEAPOT                     = 418; // I'm a Teapot
  HTTP_TOO_MANY_CONNECTIONS_FROM_YOU   = 421; // There are too many connections from your internet address
  HTTP_UNPROCESSABLE_ENTITY            = 422; // Unprocessable Entity
  HTTP_LOCKED                          = 423; // Locked
  HTTP_FAILED_DEPENDENCY               = 424; // Failed Dependency
  HTTP_UNORDERED_COLLECTION            = 425; // Unordered Collection
  HTTP_UPGRADE_REQUIRED                = 426; // Upgrade Required
  HTTP_INTERNAL_SERVER_ERROR           = 500; // Internal Server Error
//  500.0; // Module or ISAPI error occurred.
//  500.11; // Application is shutting down on the Web server.
//  500.12; // Application is busy restarting on the Web server.
//  500.13; // Web server is too busy.
//  500.15; // Direct requests for Global.asax are not allowed.
//  500.19; // Configuration data is invalid.
//  500.21; // Module not recognized.
//  500.22; // An ASP.NET httpModules configuration does not apply in Managed Pipeline mode.
//  500.23; // An ASP.NET httpHandlers configuration does not apply in Managed Pipeline mode.
//  500.24; // An ASP.NET impersonation configuration does not apply in Managed Pipeline mode.
  HTTP_INTERNAL_ASP_ERROR              = 500.100; // Internal ASP error.
  HTTP_NOT_IMPLEMENTED                 = 501; // Not Implemented
  HTTP_BAD_GATEWAY                     = 502; // Bad Gateway
  HTTP_CGI_APP_TIMEOUT                 = 502.1; // CGI application timeout.
  HTTP_BAD_GATEWAY_                    = 502.2; // Bad gateway.
  HTTP_SERVICE_UNAVAILABLE             = 503; // Service Unavailable
  HTTP_APPLICATION_POOL_UNAVAILABLE    = 503.0; // Application pool unavailable.
  HTTP_CONCURRENT_REQUEST_LIMIT        = 503.2; // Concurrent request limit exceeded.
  HTTP_GATEWAY_TIMEOUT                 = 504; // Gateway Timeout
  HTTP_VERSION_NOT_SUPPORTED           = 505; // HTTP Version not supported
  HTTP_VARIANT_ALSO_NEGOTIATES         = 506; // Variant Also Negotiates
  HTTP_INSUFFIICIENT_STORAGE           = 507; // Insufficient Storage
  HTTP_BANDWIDTH_LIMIT_EXCEEDED        = 509; // Bandwidth Limit Exceeded
  HTTP_NOT_EXTENDED                    = 510; // Not Extended

const // win32_status_code
  ERROR_SUCCESS                    =    0; // The operation completed successfully.
  ERROR_INVALID_FUNCTION           =    1; // Incorrect function.
  ERROR_FILE_NOT_FOUND             =    2; // The system cannot find the file specified.
  ERROR_PATH_NOT_FOUND             =    3; // The system cannot find the path specified.
  ERROR_TOO_MANY_OPEN_FILES        =    4; // The system cannot open the file.
  ERROR_ACCESS_DENIED              =    5; // Access is denied.
  ERROR_INVALID_HANDLE             =    6; // The handle is invalid.
  ERROR_ARENA_TRASHED              =    7; // The storage control blocks were destroyed.
  ERROR_NOT_ENOUGH_MEMORY          =    8; // Not enough storage is available to process this command.
  ERROR_INVALID_BLOCK              =    9; // The storage control block address is invalid.
  ERROR_BAD_ENVIRONMENT            =   10; // The environment is incorrect.
  ERROR_BAD_FORMAT                 =   11; // An attempt was made to load a program with an incorrect format.
  ERROR_INVALID_ACCESS             =   12; // The access code is invalid.
  ERROR_INVALID_DATA               =   13; // The data is invalid.
  ERROR_OUTOFMEMORY                =   14; // Not enough storage is available to complete this operation.
  ERROR_INVALID_DRIVE              =   15; // The system cannot find the drive specified.
  ERROR_CURRENT_DIRECTORY          =   16; // The directory cannot be removed.
  ERROR_NOT_SAME_DEVICE            =   17; // The system cannot move the file to a different disk drive.
  ERROR_NO_MORE_FILES              =   18; // There are no more files.
  ERROR_WRITE_PROTECT              =   19; // The media is write protected.
  ERROR_BAD_UNIT                   =   20; // The system cannot find the device specified.
  ERROR_NOT_READY                  =   21; // The device is not ready.
  ERROR_BAD_COMMAND                =   22; // The device does not recognize the command.
  ERROR_CRC                        =   23; // Data error (cyclic redundancy check).
  ERROR_BAD_LENGTH                 =   24; // The program issued a command but the command length is incorrect.
  ERROR_SEEK                       =   25; // The drive cannot locate a specific area or track on the disk.
  ERROR_NOT_DOS_DISK               =   26; // The specified disk or diskette cannot be accessed.
  ERROR_SECTOR_NOT_FOUND           =   27; // The drive cannot find the sector requested.
  ERROR_OUT_OF_PAPER               =   28; // The printer is out of paper.
  ERROR_WRITE_FAULT                =   29; // The system cannot write to the specified device.
  ERROR_READ_FAULT                 =   30; // The system cannot read from the specified device.
  ERROR_GEN_FAILURE                =   31; // A device attached to the system is not functioning.
  ERROR_SHARING_VIOLATION          =   32; // The process cannot access the file because it is being used by another process.
  ERROR_LOCK_VIOLATION             =   33; // The process cannot access the file because another process has locked a portion of the file.
  ERROR_WRONG_DISK                 =   34; // The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1.
  ERROR_SHARING_BUFFER_EXCEEDED    =   36; // Too many files opened for sharing.
  ERROR_HANDLE_EOF                 =   38; // Reached the end of the file.
  ERROR_HANDLE_DISK_FULL           =   39; // The disk is full.
  ERROR_NOT_SUPPORTED              =   50; // The request is not supported.
  ERROR_REM_NOT_LIST               =   51; // Windows cannot find the network path. Verify that the network path is correct and the destination computer is not busy or turned off. If Windows still cannot find the network path, contact your network administrator.
  ERROR_DUP_NAME                   =   52; // You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a workgroup, choose another workgroup name.
  ERROR_BAD_NETPATH                =   53; // The network path was not found.
  ERROR_NETWORK_BUSY               =   54; // The network is busy.
  ERROR_DEV_NOT_EXIST              =   55; // The specified network resource or device is no longer available.
  ERROR_TOO_MANY_CMDS              =   56; // The network BIOS command limit has been reached.
  ERROR_ADAP_HDW_ERR               =   57; // A network adapter hardware error occurred.
  ERROR_BAD_NET_RESP               =   58; // The specified server cannot perform the requested operation.
  ERROR_UNEXP_NET_ERR              =   59; // An unexpected network error occurred.
  ERROR_BAD_REM_ADAP               =   60; // The remote adapter is not compatible.
  ERROR_PRINTQ_FULL                =   61; // The printer queue is full.
  ERROR_NO_SPOOL_SPACE             =   62; // Space to store the file waiting to be printed is not available on the server.
  ERROR_PRINT_CANCELLED            =   63; // Your file waiting to be printed was deleted.
  ERROR_NETNAME_DELETED            =   64; // The specified network name is no longer available.
  ERROR_NETWORK_ACCESS_DENIED      =   65; // Network access is denied.
  ERROR_BAD_DEV_TYPE               =   66; // The network resource type is not correct.
  ERROR_BAD_NET_NAME               =   67; // The network name cannot be found.
  ERROR_TOO_MANY_NAMES             =   68; // The name limit for the local computer network adapter card was exceeded.
  ERROR_TOO_MANY_SESS              =   69; // The network BIOS session limit was exceeded.
  ERROR_SHARING_PAUSED             =   70; // The remote server has been paused or is in the process of being started.
  ERROR_REQ_NOT_ACCEP              =   71; // No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept.
  ERROR_REDIR_PAUSED               =   72; // The specified printer or disk device has been paused.
  ERROR_FILE_EXISTS                =   80; // The file exists.
  ERROR_CANNOT_MAKE                =   82; // The directory or file cannot be created.
  ERROR_FAIL_I24                   =   83; // Fail on INT 24.
  ERROR_OUT_OF_STRUCTURES          =   84; // Storage to process this request is not available.
  ERROR_ALREADY_ASSIGNED           =   85; // The local device name is already in use.
  ERROR_INVALID_PASSWORD           =   86; // The specified network password is not correct.
  ERROR_INVALID_PARAMETER          =   87; // The parameter is incorrect.
  ERROR_NET_WRITE_FAULT            =   88; // A write fault occurred on the network.
  ERROR_NO_PROC_SLOTS              =   89; // The system cannot start another process at this time.
  ERROR_TOO_MANY_SEMAPHORES        =  100; // Cannot create another system semaphore.
  ERROR_EXCL_SEM_ALREADY_OWNED     =  101; // The exclusive semaphore is owned by another process.
  ERROR_SEM_IS_SET                 =  102; // The semaphore is set and cannot be closed.
  ERROR_TOO_MANY_SEM_REQUESTS      =  103; // The semaphore cannot be set again.
  ERROR_INVALID_AT_INTERRUPT_TIME  =  104; // Cannot request exclusive semaphores at interrupt time.
  ERROR_SEM_OWNER_DIED             =  105; // The previous ownership of this semaphore has ended.
  ERROR_SEM_USER_LIMIT             =  106; // Insert the diskette for drive %1.
  ERROR_DISK_CHANGE                =  107; // The program stopped because an alternate diskette was not inserted.
  ERROR_DRIVE_LOCKED               =  108; // The disk is in use or locked by another process.
  ERROR_BROKEN_PIPE                =  109; // The pipe has been ended.
  ERROR_OPEN_FAILED                =  110; // The system cannot open the device or file specified.
  ERROR_BUFFER_OVERFLOW            =  111; // The file name is too long.
  ERROR_DISK_FULL                  =  112; // There is not enough space on the disk.
  ERROR_NO_MORE_SEARCH_HANDLES     =  113; // No more internal file identifiers available.
  ERROR_INVALID_TARGET_HANDLE      =  114; // The target internal file identifier is incorrect.
  ERROR_INVALID_CATEGORY           =  117; // The IOCTL call made by the application program is not correct.
  ERROR_INVALID_VERIFY_SWITCH      =  118; // The verify-on-write switch parameter value is not correct.
  ERROR_BAD_DRIVER_LEVEL           =  119; // The system does not support the command requested.
  ERROR_CALL_NOT_IMPLEMENTED       =  120; // This function is not supported on this system.
  ERROR_SEM_TIMEOUT                =  121; // The semaphore timeout period has expired.
  ERROR_INSUFFICIENT_BUFFER        =  122; // The data area passed to a system call is too small.
  ERROR_INVALID_NAME               =  123; // The filename, directory name, or volume label syntax is incorrect.
  ERROR_INVALID_LEVEL              =  124; // The system call level is not correct.
  ERROR_NO_VOLUME_LABEL            =  125; // The disk has no volume label.
  ERROR_MOD_NOT_FOUND              =  126; // The specified module could not be found.
  ERROR_PROC_NOT_FOUND             =  127; // The specified procedure could not be found.
  ERROR_WAIT_NO_CHILDREN           =  128; // There are no child processes to wait for.
  ERROR_CHILD_NOT_COMPLETE         =  129; // The %1 application cannot be run in Win32 mode.
  ERROR_DIRECT_ACCESS_HANDLE       =  130; // Attempt to use a file handle to an open disk partition for an operation other than raw disk I/O.
  ERROR_NEGATIVE_SEEK              =  131; // An attempt was made to move the file pointer before the beginning of the file.
  ERROR_SEEK_ON_DEVICE             =  132; // The file pointer cannot be set on the specified device or file.
  ERROR_IS_JOIN_TARGET             =  133; // A JOIN or SUBST command cannot be used for a drive that contains previously joined drives.
  ERROR_IS_JOINED                  =  134; // An attempt was made to use a JOIN or SUBST command on a drive that has already been joined.
  ERROR_IS_SUBSTED                 =  135; // An attempt was made to use a JOIN or SUBST command on a drive that has already been substituted.
  ERROR_NOT_JOINED                 =  136; // The system tried to delete the JOIN of a drive that is not joined.
  ERROR_NOT_SUBSTED                =  137; // The system tried to delete the substitution of a drive that is not substituted.
  ERROR_JOIN_TO_JOIN               =  138; // The system tried to join a drive to a directory on a joined drive.
  ERROR_SUBST_TO_SUBST             =  139; // The system tried to substitute a drive to a directory on a substituted drive.
  ERROR_JOIN_TO_SUBST              =  140; // The system tried to join a drive to a directory on a substituted drive.
  ERROR_SUBST_TO_JOIN              =  141; // The system tried to SUBST a drive to a directory on a joined drive.
  ERROR_BUSY_DRIVE                 =  142; // The system cannot perform a JOIN or SUBST at this time.
  ERROR_SAME_DRIVE                 =  143; // The system cannot join or substitute a drive to or for a directory on the same drive.
  ERROR_DIR_NOT_ROOT               =  144; // The directory is not a subdirectory of the root directory.
  ERROR_DIR_NOT_EMPTY              =  145; // The directory is not empty.
  ERROR_IS_SUBST_PATH              =  146; // The path specified is being used in a substitute.
  ERROR_IS_JOIN_PATH               =  147; // Not enough resources are available to process this command.
  ERROR_PATH_BUSY                  =  148; // The path specified cannot be used at this time.
  ERROR_IS_SUBST_TARGET            =  149; // An attempt was made to join or substitute a drive for which a directory on the drive is the target of a previous substitute.
  ERROR_SYSTEM_TRACE               =  150; // System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
  ERROR_INVALID_EVENT_COUNT        =  151; // The number of specified semaphore events for DosMuxSemWait is not correct.
  ERROR_TOO_MANY_MUXWAITERS        =  152; // DosMuxSemWait did not execute; too many semaphores are already set.
  ERROR_INVALID_LIST_FORMAT        =  153; // The DosMuxSemWait list is not correct.
  ERROR_LABEL_TOO_LONG             =  154; // The volume label you entered exceeds the label character limit of the target file system.
  ERROR_TOO_MANY_TCBS              =  155; // Cannot create another thread.
  ERROR_SIGNAL_REFUSED             =  156; // The recipient process has refused the signal.
  ERROR_DISCARDED                  =  157; // The segment is already discarded and cannot be locked.
  ERROR_NOT_LOCKED                 =  158; // The segment is already unlocked.
  ERROR_BAD_THREADID_ADDR          =  159; // The address for the thread ID is not correct.
  ERROR_BAD_ARGUMENTS              =  160; // One or more arguments are not correct.
  ERROR_BAD_PATHNAME               =  161; // The specified path is invalid.
  ERROR_SIGNAL_PENDING             =  162; // A signal is already pending.
  ERROR_MAX_THRDS_REACHED          =  164; // No more threads can be created in the system.
  ERROR_LOCK_FAILED                =  167; // Unable to lock a region of a file.
  ERROR_BUSY                       =  170; // The requested resource is in use.
  ERROR_DEVICE_SUPPORT_IN_PROGRESS =  171; // Device's command support detection is in progress.
  ERROR_CANCEL_VIOLATION           =  173; // A lock request was not outstanding for the supplied cancel region.
  ERROR_ATOMIC_LOCKS_NOT_SUPPORTED =  174; // The file system does not support atomic changes to the lock type.
  ERROR_INVALID_SEGMENT_NUMBER     =  180; // The system detected a segment number that was not correct.
  ERROR_INVALID_ORDINAL            =  182; // The operating system cannot run %1.
  ERROR_ALREADY_EXISTS             =  183; // Cannot create a file when that file already exists.
  ERROR_INVALID_FLAG_NUMBER        =  186; // The flag passed is not correct.
  ERROR_SEM_NOT_FOUND              =  187; // The specified system semaphore name was not found.
  ERROR_INVALID_STARTING_CODESEG   =  188; // The operating system cannot run %1.
  ERROR_INVALID_STACKSEG           =  189; // The operating system cannot run %1.
  ERROR_INVALID_MODULETYPE         =  190; // The operating system cannot run %1.
  ERROR_INVALID_EXE_SIGNATURE      =  191; // Cannot run %1 in Win32 mode.
  ERROR_EXE_MARKED_INVALID         =  192; // The operating system cannot run %1.
  ERROR_BAD_EXE_FORMAT             =  193; // %1 is not a valid Win32 application.
  ERROR_ITERATED_DATA_EXCEEDS_64k  =  194; // The operating system cannot run %1.
  ERROR_INVALID_MINALLOCSIZE       =  195; // The operating system cannot run %1.
  ERROR_DYNLINK_FROM_INVALID_RING  =  196; // The operating system cannot run this application program.
  ERROR_IOPL_NOT_ENABLED           =  197; // The operating system is not presently configured to run this application.
  ERROR_INVALID_SEGDPL             =  198; // The operating system cannot run %1.
  ERROR_AUTODATASEG_EXCEEDS_64k    =  199; // The operating system cannot run this application program.
  ERROR_RING2SEG_MUST_BE_MOVABLE   =  200; // The code segment cannot be greater than or equal to 64K.
  ERROR_RELOC_CHAIN_XEEDS_SEGLIM   =  201; // The operating system cannot run %1.
  ERROR_INFLOOP_IN_RELOC_CHAIN     =  202; // The operating system cannot run %1.
  ERROR_ENVVAR_NOT_FOUND           =  203; // The system could not find the environment option that was entered.
  ERROR_NO_SIGNAL_SENT             =  205; // No process in the command subtree has a signal handler.
  ERROR_FILENAME_EXCED_RANGE       =  206; // The filename or extension is too long.
  ERROR_RING2_STACK_IN_USE         =  207; // The ring 2 stack is in use.
  ERROR_META_EXPANSION_TOO_LONG    =  208; // The global filename characters, * or ?, are entered incorrectly or too many global filename characters are specified.
  ERROR_INVALID_SIGNAL_NUMBER      =  209; // The signal being posted is not correct.
  ERROR_THREAD_1_INACTIVE          =  210; // The signal handler cannot be set.
  ERROR_LOCKED                     =  212; // The segment is locked and cannot be reallocated.
  ERROR_TOO_MANY_MODULES           =  214; // Too many dynamic-link modules are attached to this program or dynamic-link module.
  ERROR_NESTING_NOT_ALLOWED        =  215; // Cannot nest calls to LoadModule.
  ERROR_EXE_MACHINE_TYPE_MISMATCH  =  216; // This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.
  ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY =  217; // The image file %1 is signed, unable to modify.
  ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY =  218; // The image file %1 is strong signed, unable to modify.
  ERROR_FILE_CHECKED_OUT           =  220; // This file is checked out or locked for editing by another user.
  ERROR_CHECKOUT_REQUIRED          =  221; // The file must be checked out before saving changes.
  ERROR_BAD_FILE_TYPE              =  222; // The file type being saved or retrieved has been blocked.
  ERROR_FILE_TOO_LARGE             =  223; // The file size exceeds the limit allowed and cannot be saved.
  ERROR_FORMS_AUTH_REQUIRED        =  224; // Access Denied. Before opening files in this location, you must first add the web site to your trusted sites list, browse to the web site, and select the option to login automatically.
  ERROR_VIRUS_INFECTED             =  225; // Operation did not complete successfully because the file contains a virus or potentially unwanted software.
  ERROR_VIRUS_DELETED              =  226; // This file contains a virus or potentially unwanted software and cannot be opened. Due to the nature of this virus or potentially unwanted software, the file has been removed from this location.
  ERROR_PIPE_LOCAL                 =  229; // The pipe is local.
  ERROR_BAD_PIPE                   =  230; // The pipe state is invalid.
  ERROR_PIPE_BUSY                  =  231; // All pipe instances are busy.
  ERROR_NO_DATA                    =  232; // The pipe is being closed.
  ERROR_PIPE_NOT_CONNECTED         =  233; // No process is on the other end of the pipe.
  ERROR_MORE_DATA                  =  234; // More data is available.
  ERROR_VC_DISCONNECTED            =  240; // The session was canceled.
  ERROR_INVALID_EA_NAME            =  254; // The specified extended attribute name was invalid.
  ERROR_EA_LIST_INCONSISTENT       =  255; // The extended attributes are inconsistent.
  WAIT_TIMEOUT                     =  258; // The wait operation timed out.
  ERROR_NO_MORE_ITEMS              =  259; // No more data is available.
  ERROR_CANNOT_COPY                =  266; // The copy functions cannot be used.
  ERROR_DIRECTORY                  =  267; // The directory name is invalid.
  ERROR_EAS_DIDNT_FIT              =  275; // The extended attributes did not fit in the buffer.
  ERROR_EA_FILE_CORRUPT            =  276; // The extended attribute file on the mounted file system is corrupt.
  ERROR_EA_TABLE_FULL              =  277; // The extended attribute table file is full.
  ERROR_INVALID_EA_HANDLE          =  278; // The specified extended attribute handle is invalid.
  ERROR_EAS_NOT_SUPPORTED          =  282; // The mounted file system does not support extended attributes.
  ERROR_NOT_OWNER                  =  288; // Attempt to release mutex not owned by caller.
  ERROR_TOO_MANY_POSTS             =  298; // Too many posts were made to a semaphore.
  ERROR_PARTIAL_COPY               =  299; // Only part of a ReadProcessMemory or WriteProcessMemory request was completed.
  ERROR_OPLOCK_NOT_GRANTED         =  300; // The oplock request is denied.
  ERROR_INVALID_OPLOCK_PROTOCOL    =  301; // An invalid oplock acknowledgment was received by the system.
  ERROR_DISK_TOO_FRAGMENTED        =  302; // The volume is too fragmented to complete this operation.
  ERROR_DELETE_PENDING             =  303; // The file cannot be opened because it is in the process of being deleted.
  ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING =  304; // Short name settings may not be changed on this volume due to the global registry setting.
  ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME =  305; // Short names are not enabled on this volume.
  ERROR_SECURITY_STREAM_IS_INCONSISTENT =  306; // The security stream for the given volume is in an inconsistent state. Please run CHKDSK on the volume.
  ERROR_INVALID_LOCK_RANGE         =  307; // A requested file lock operation cannot be processed due to an invalid byte range.
  ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT =  308; // The subsystem needed to support the image type is not present.
  ERROR_NOTIFICATION_GUID_ALREADY_DEFINED =  309; // The specified file already has a notification GUID associated with it.
  ERROR_INVALID_EXCEPTION_HANDLER  =  310; // An invalid exception handler routine has been detected.
  ERROR_DUPLICATE_PRIVILEGES       =  311; // Duplicate privileges were specified for the token.
  ERROR_NO_RANGES_PROCESSED        =  312; // No ranges for the specified operation were able to be processed.
  ERROR_NOT_ALLOWED_ON_SYSTEM_FILE =  313; // Operation is not allowed on a file system internal file.
  ERROR_DISK_RESOURCES_EXHAUSTED   =  314; // The physical resources of this disk have been exhausted.
  ERROR_INVALID_TOKEN              =  315; // The token representing the data is invalid.
  ERROR_DEVICE_FEATURE_NOT_SUPPORTED =  316; // The device does not support the command feature.
  ERROR_MR_MID_NOT_FOUND           =  317; // The system cannot find message text for message number 0x%1 in the message file for %2.
  ERROR_SCOPE_NOT_FOUND            =  318; // The scope specified was not found.
  ERROR_UNDEFINED_SCOPE            =  319; // The Central Access Policy specified is not defined on the target machine.
  ERROR_INVALID_CAP                =  320; // The Central Access Policy obtained from Active Directory is invalid.
  ERROR_DEVICE_UNREACHABLE         =  321; // The device is unreachable.
  ERROR_DEVICE_NO_RESOURCES        =  322; // The target device has insufficient resources to complete the operation.
  ERROR_DATA_CHECKSUM_ERROR        =  323; // A data integrity checksum error occurred. Data in the file stream is corrupt.
  ERROR_INTERMIXED_KERNEL_EA_OPERATION =  324; // An attempt was made to modify both a KERNEL and normal Extended Attribute (EA) in the same operation.
  ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED =  326; // Device does not support file-level TRIM.
  ERROR_OFFSET_ALIGNMENT_VIOLATION =  327; // The command specified a data offset that does not align to the device's granularity/alignment.
  ERROR_INVALID_FIELD_IN_PARAMETER_LIST =  328; // The command specified an invalid field in its parameter list.
  ERROR_OPERATION_IN_PROGRESS      =  329; // An operation is currently in progress with the device.
  ERROR_BAD_DEVICE_PATH            =  330; // An attempt was made to send down the command via an invalid path to the target device.
  ERROR_TOO_MANY_DESCRIPTORS       =  331; // The command specified a number of descriptors that exceeded the maximum supported by the device.
  ERROR_SCRUB_DATA_DISABLED        =  332; // Scrub is disabled on the specified file.
  ERROR_NOT_REDUNDANT_STORAGE      =  333; // The storage device does not provide redundancy.
  ERROR_RESIDENT_FILE_NOT_SUPPORTED =  334; // An operation is not supported on a resident file.
  ERROR_COMPRESSED_FILE_NOT_SUPPORTED =  335; // An operation is not supported on a compressed file.
  ERROR_DIRECTORY_NOT_SUPPORTED    =  336; // An operation is not supported on a directory.
  ERROR_NOT_READ_FROM_COPY         =  337; // The specified copy of the requested data could not be read.
  ERROR_FAIL_NOACTION_REBOOT       =  350; // No action was taken as a system reboot is required.
  ERROR_FAIL_SHUTDOWN              =  351; // The shutdown operation failed.
  ERROR_FAIL_RESTART               =  352; // The restart operation failed.
  ERROR_MAX_SESSIONS_REACHED       =  353; // The maximum number of sessions has been reached.
  ERROR_THREAD_MODE_ALREADY_BACKGROUND =  400; // The thread is already in background processing mode.
  ERROR_THREAD_MODE_NOT_BACKGROUND =  401; // The thread is not in background processing mode.
  ERROR_PROCESS_MODE_ALREADY_BACKGROUND =  402; // The process is already in background processing mode.
  ERROR_PROCESS_MODE_NOT_BACKGROUND =  403; // The process is not in background processing mode.
  ERROR_INVALID_ADDRESS            =  487; // Attempt to access invalid address.


  function http_Status_Msg(const http_Status_Code: DWORD): string;
  function win32_Error_Msg(const win32_Error_Code: DWORD): string;

implementation

function http_Status_Msg(const http_Status_Code: DWORD): string;
begin
  case http_Status_Code of
    HTTP_CONTINUE                        : result := 'Continue';
    HTTP_SWITCHING_PROTOCOLS             : result := 'Switching Protocols';
    HTTP_PROCESSING                      : result := 'Processing';
    HTTP_OK                              : result := 'OK';
    HTTP_CREATED                         : result := 'Created';
    HTTP_ACCEPTED                        : result := 'Accepted';
    HTTP_NON_AUTHORITATIVE_INFORMATION   : result := 'Non-Authoritative Information';
    HTTP_NO_CONTENT                      : result := 'No Content';
    HTTP_RESET_CONTENT                   : result := 'Reset Content';
    HTTP_PARTIAL_CONTENT                 : result := 'Partial Content';
    HTTP_MULTI_STATUS                    : result := 'Multi-Status';
    HTTP_MULTIPLE_CHOICE                 : result := 'Multiple Choice';
    HTTP_MOVED_PERMANENTLY               : result := 'Moved Permanently';
    HTTP_MOVED_TEMPORARILY               : result := 'Found';
    HTTP_SEE_OTHER                       : result := 'See Other';
    HTTP_NOT_MODIFIED                    : result := 'Not Modified';
    HTTP_USE_PROXY                       : result := 'Use Proxy';
    HTTP_SWITCH_PROXY                    : result := 'Switch Proxy';
    HTTP_TEMPORARY_REDIRECT              : result := 'Temporary Redirect';
    HTTP_BAD_REQUEST                     : result := 'Bad Request';
    HTTP_UNAUTHORIZED                    : result := 'Unauthorized';
    HTTP_PAYMENT_REQUIRED                : result := 'Payment Required';
    HTTP_FORBIDDEN                       : result := 'Forbidden';
    HTTP_NOT_FOUND                       : result := 'Not Found';
    HTTP_METHOD_NOT_ALLOWED              : result := 'Method Not Allowed';
    HTTP_NOT_ACCEPTABLE                  : result := 'Not Acceptable';
    HTTP_PROXY_AUTHENTICATION_REQUIRED   : result := 'Proxy Authentication Required';
    HTTP_REQUEST_TIMEOUT                 : result := 'Request Time-out';
    HTTP_CONFLICT                        : result := 'Conflict';
    HTTP_GONE                            : result := 'Gone';
    HTTP_LENGTH_REQUIRED                 : result := 'Length Required';
    HTTP_PRECONDITION_FAILED             : result := 'Precondition Failed';
    HTTP_REQUEST_ENTITY_TOO_LARGE        : result := 'Request Entity Too Large';
    HTTP_REQUEST_URI_TOO_LONG            : result := 'Request-URI Too Long';
    HTTP_UNSUPPORTED_MEDIA_TYPE          : result := 'Unsupported Media Type';
    HTTP_REQUESTED_RANGE_NOT_SATISFIABLE : result := 'Requested range not satisfiable';
    HTTP_EXPECTATION_FAILED              : result := 'Expectation Failed';
    HTTP_IM_A_TEAPOT                     : result := 'I''m a Teapot';
    HTTP_TOO_MANY_CONNECTIONS_FROM_YOU   : result := 'There are too many connections from your internet address';
    HTTP_UNPROCESSABLE_ENTITY            : result := 'Unprocessable Entity';
    HTTP_LOCKED                          : result := 'Locked';
    HTTP_FAILED_DEPENDENCY               : result := 'Failed Dependency';
    HTTP_UNORDERED_COLLECTION            : result := 'Unordered Collection';
    HTTP_UPGRADE_REQUIRED                : result := 'Upgrade Required';
    HTTP_INTERNAL_SERVER_ERROR           : result := 'Internal Server Error';
    HTTP_NOT_IMPLEMENTED                 : result := 'Not Implemented';
    HTTP_BAD_GATEWAY                     : result := 'Bad Gateway';
    HTTP_SERVICE_UNAVAILABLE             : result := 'Service Unavailable';
    HTTP_GATEWAY_TIMEOUT                 : result := 'Gateway Time-out';
    HTTP_VERSION_NOT_SUPPORTED           : result := 'HTTP Version not supported';
    HTTP_VARIANT_ALSO_NEGOTIATES         : result := 'Variant Also Negotiates';
    HTTP_INSUFFIICIENT_STORAGE           : result := 'Insufficient Storage';
    HTTP_BANDWIDTH_LIMIT_EXCEEDED        : result := 'Bandwidth Limit Exceeded';
    HTTP_NOT_EXTENDED                    : result := 'Not Extended';
  end;
end;

function win32_Error_Msg(const win32_Error_Code: DWORD): string;
begin
  case win32_Error_Code of
    ERROR_SUCCESS                    : result := 'The operation completed successfully.';
    ERROR_INVALID_FUNCTION           : result := 'Incorrect function.';
    ERROR_FILE_NOT_FOUND             : result := 'The system cannot find the file specified.';
    ERROR_PATH_NOT_FOUND             : result := 'The system cannot find the path specified.';
    ERROR_TOO_MANY_OPEN_FILES        : result := 'The system cannot open the file.';
    ERROR_ACCESS_DENIED              : result := 'Access is denied.';
    ERROR_INVALID_HANDLE             : result := 'The handle is invalid.';
    ERROR_ARENA_TRASHED              : result := 'The storage control blocks were destroyed.';
    ERROR_NOT_ENOUGH_MEMORY          : result := 'Not enough storage is available to process this command.';
    ERROR_INVALID_BLOCK              : result := 'The storage control block address is invalid.';
    ERROR_BAD_ENVIRONMENT            : result := 'The environment is incorrect.';
    ERROR_BAD_FORMAT                 : result := 'An attempt was made to load a program with an incorrect format.';
    ERROR_INVALID_ACCESS             : result := 'The access code is invalid.';
    ERROR_INVALID_DATA               : result := 'The data is invalid.';
    ERROR_OUTOFMEMORY                : result := 'Not enough storage is available to complete this operation.';
    ERROR_INVALID_DRIVE              : result := 'The system cannot find the drive specified.';
    ERROR_CURRENT_DIRECTORY          : result := 'The directory cannot be removed.';
    ERROR_NOT_SAME_DEVICE            : result := 'The system cannot move the file to a different disk drive.';
    ERROR_NO_MORE_FILES              : result := 'There are no more files.';
    ERROR_WRITE_PROTECT              : result := 'The media is write protected.';
    ERROR_BAD_UNIT                   : result := 'The system cannot find the device specified.';
    ERROR_NOT_READY                  : result := 'The device is not ready.';
    ERROR_BAD_COMMAND                : result := 'The device does not recognize the command.';
    ERROR_CRC                        : result := 'Data error (cyclic redundancy check).';
    ERROR_BAD_LENGTH                 : result := 'The program issued a command but the command length is incorrect.';
    ERROR_SEEK                       : result := 'The drive cannot locate a specific area or track on the disk.';
    ERROR_NOT_DOS_DISK               : result := 'The specified disk or diskette cannot be accessed.';
    ERROR_SECTOR_NOT_FOUND           : result := 'The drive cannot find the sector requested.';
    ERROR_OUT_OF_PAPER               : result := 'The printer is out of paper.';
    ERROR_WRITE_FAULT                : result := 'The system cannot write to the specified device.';
    ERROR_READ_FAULT                 : result := 'The system cannot read from the specified device.';
    ERROR_GEN_FAILURE                : result := 'A device attached to the system is not functioning.';
    ERROR_SHARING_VIOLATION          : result := 'The process cannot access the file because it is being used by another process.';
    ERROR_LOCK_VIOLATION             : result := 'The process cannot access the file because another process has locked a portion of the file.';
    ERROR_WRONG_DISK                 : result := 'The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1.';
    ERROR_SHARING_BUFFER_EXCEEDED    : result := 'Too many files opened for sharing.';
    ERROR_HANDLE_EOF                 : result := 'Reached the end of the file.';
    ERROR_HANDLE_DISK_FULL           : result := 'The disk is full.';
    ERROR_NOT_SUPPORTED              : result := 'The request is not supported.';
    ERROR_REM_NOT_LIST               : result := 'Windows cannot find the network path. Verify that the network path is correct and the destination computer is not busy or turned off. If Windows still cannot find the network path, contact your network administrator.';
    ERROR_DUP_NAME                   : result := 'You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a workgroup, choose another workgroup name.';
    ERROR_BAD_NETPATH                : result := 'The network path was not found.';
    ERROR_NETWORK_BUSY               : result := 'The network is busy.';
    ERROR_DEV_NOT_EXIST              : result := 'The specified network resource or device is no longer available.';
    ERROR_TOO_MANY_CMDS              : result := 'The network BIOS command limit has been reached.';
    ERROR_ADAP_HDW_ERR               : result := 'A network adapter hardware error occurred.';
    ERROR_BAD_NET_RESP               : result := 'The specified server cannot perform the requested operation.';
    ERROR_UNEXP_NET_ERR              : result := 'An unexpected network error occurred.';
    ERROR_BAD_REM_ADAP               : result := 'The remote adapter is not compatible.';
    ERROR_PRINTQ_FULL                : result := 'The printer queue is full.';
    ERROR_NO_SPOOL_SPACE             : result := 'Space to store the file waiting to be printed is not available on the server.';
    ERROR_PRINT_CANCELLED            : result := 'Your file waiting to be printed was deleted.';
    ERROR_NETNAME_DELETED            : result := 'The specified network name is no longer available.';
    ERROR_NETWORK_ACCESS_DENIED      : result := 'Network access is denied.';
    ERROR_BAD_DEV_TYPE               : result := 'The network resource type is not correct.';
    ERROR_BAD_NET_NAME               : result := 'The network name cannot be found.';
    ERROR_TOO_MANY_NAMES             : result := 'The name limit for the local computer network adapter card was exceeded.';
    ERROR_TOO_MANY_SESS              : result := 'The network BIOS session limit was exceeded.';
    ERROR_SHARING_PAUSED             : result := 'The remote server has been paused or is in the process of being started.';
    ERROR_REQ_NOT_ACCEP              : result := 'No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept.';
    ERROR_REDIR_PAUSED               : result := 'The specified printer or disk device has been paused.';
    ERROR_FILE_EXISTS                : result := 'The file exists.';
    ERROR_CANNOT_MAKE                : result := 'The directory or file cannot be created.';
    ERROR_FAIL_I24                   : result := 'Fail on INT 24.';
    ERROR_OUT_OF_STRUCTURES          : result := 'Storage to process this request is not available.';
    ERROR_ALREADY_ASSIGNED           : result := 'The local device name is already in use.';
    ERROR_INVALID_PASSWORD           : result := 'The specified network password is not correct.';
    ERROR_INVALID_PARAMETER          : result := 'The parameter is incorrect.';
    ERROR_NET_WRITE_FAULT            : result := 'A write fault occurred on the network.';
    ERROR_NO_PROC_SLOTS              : result := 'The system cannot start another process at this time.';
    ERROR_TOO_MANY_SEMAPHORES        : result := 'Cannot create another system semaphore.';
    ERROR_EXCL_SEM_ALREADY_OWNED     : result := 'The exclusive semaphore is owned by another process.';
    ERROR_SEM_IS_SET                 : result := 'The semaphore is set and cannot be closed.';
    ERROR_TOO_MANY_SEM_REQUESTS      : result := 'The semaphore cannot be set again.';
    ERROR_INVALID_AT_INTERRUPT_TIME  : result := 'Cannot request exclusive semaphores at interrupt time.';
    ERROR_SEM_OWNER_DIED             : result := 'The previous ownership of this semaphore has ended.';
    ERROR_SEM_USER_LIMIT             : result := 'Insert the diskette for drive %1.';
    ERROR_DISK_CHANGE                : result := 'The program stopped because an alternate diskette was not inserted.';
    ERROR_DRIVE_LOCKED               : result := 'The disk is in use or locked by another process.';
    ERROR_BROKEN_PIPE                : result := 'The pipe has been ended.';
    ERROR_OPEN_FAILED                : result := 'The system cannot open the device or file specified.';
    ERROR_BUFFER_OVERFLOW            : result := 'The file name is too long.';
    ERROR_DISK_FULL                  : result := 'There is not enough space on the disk.';
    ERROR_NO_MORE_SEARCH_HANDLES     : result := 'No more internal file identifiers available.';
    ERROR_INVALID_TARGET_HANDLE      : result := 'The target internal file identifier is incorrect.';
    ERROR_INVALID_CATEGORY           : result := 'The IOCTL call made by the application program is not correct.';
    ERROR_INVALID_VERIFY_SWITCH      : result := 'The verify-on-write switch parameter value is not correct.';
    ERROR_BAD_DRIVER_LEVEL           : result := 'The system does not support the command requested.';
    ERROR_CALL_NOT_IMPLEMENTED       : result := 'This function is not supported on this system.';
    ERROR_SEM_TIMEOUT                : result := 'The semaphore timeout period has expired.';
    ERROR_INSUFFICIENT_BUFFER        : result := 'The data area passed to a system call is too small.';
    ERROR_INVALID_NAME               : result := 'The filename, directory name, or volume label syntax is incorrect.';
    ERROR_INVALID_LEVEL              : result := 'The system call level is not correct.';
    ERROR_NO_VOLUME_LABEL            : result := 'The disk has no volume label.';
    ERROR_MOD_NOT_FOUND              : result := 'The specified module could not be found.';
    ERROR_PROC_NOT_FOUND             : result := 'The specified procedure could not be found.';
    ERROR_WAIT_NO_CHILDREN           : result := 'There are no child processes to wait for.';
    ERROR_CHILD_NOT_COMPLETE         : result := 'The %1 application cannot be run in Win32 mode.';
    ERROR_DIRECT_ACCESS_HANDLE       : result := 'Attempt to use a file handle to an open disk partition for an operation other than raw disk I/O.';
    ERROR_NEGATIVE_SEEK              : result := 'An attempt was made to move the file pointer before the beginning of the file.';
    ERROR_SEEK_ON_DEVICE             : result := 'The file pointer cannot be set on the specified device or file.';
    ERROR_IS_JOIN_TARGET             : result := 'A JOIN or SUBST command cannot be used for a drive that contains previously joined drives.';
    ERROR_IS_JOINED                  : result := 'An attempt was made to use a JOIN or SUBST command on a drive that has already been joined.';
    ERROR_IS_SUBSTED                 : result := 'An attempt was made to use a JOIN or SUBST command on a drive that has already been substituted.';
    ERROR_NOT_JOINED                 : result := 'The system tried to delete the JOIN of a drive that is not joined.';
    ERROR_NOT_SUBSTED                : result := 'The system tried to delete the substitution of a drive that is not substituted.';
    ERROR_JOIN_TO_JOIN               : result := 'The system tried to join a drive to a directory on a joined drive.';
    ERROR_SUBST_TO_SUBST             : result := 'The system tried to substitute a drive to a directory on a substituted drive.';
    ERROR_JOIN_TO_SUBST              : result := 'The system tried to join a drive to a directory on a substituted drive.';
    ERROR_SUBST_TO_JOIN              : result := 'The system tried to SUBST a drive to a directory on a joined drive.';
    ERROR_BUSY_DRIVE                 : result := 'The system cannot perform a JOIN or SUBST at this time.';
    ERROR_SAME_DRIVE                 : result := 'The system cannot join or substitute a drive to or for a directory on the same drive.';
    ERROR_DIR_NOT_ROOT               : result := 'The directory is not a subdirectory of the root directory.';
    ERROR_DIR_NOT_EMPTY              : result := 'The directory is not empty.';
    ERROR_IS_SUBST_PATH              : result := 'The path specified is being used in a substitute.';
    ERROR_IS_JOIN_PATH               : result := 'Not enough resources are available to process this command.';
    ERROR_PATH_BUSY                  : result := 'The path specified cannot be used at this time.';
    ERROR_IS_SUBST_TARGET            : result := 'An attempt was made to join or substitute a drive for which a directory on the drive is the target of a previous substitute.';
    ERROR_SYSTEM_TRACE               : result := 'System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.';
    ERROR_INVALID_EVENT_COUNT        : result := 'The number of specified semaphore events for DosMuxSemWait is not correct.';
    ERROR_TOO_MANY_MUXWAITERS        : result := 'DosMuxSemWait did not execute; too many semaphores are already set.';
    ERROR_INVALID_LIST_FORMAT        : result := 'The DosMuxSemWait list is not correct.';
    ERROR_LABEL_TOO_LONG             : result := 'The volume label you entered exceeds the label character limit of the target file system.';
    ERROR_TOO_MANY_TCBS              : result := 'Cannot create another thread.';
    ERROR_SIGNAL_REFUSED             : result := 'The recipient process has refused the signal.';
    ERROR_DISCARDED                  : result := 'The segment is already discarded and cannot be locked.';
    ERROR_NOT_LOCKED                 : result := 'The segment is already unlocked.';
    ERROR_BAD_THREADID_ADDR          : result := 'The address for the thread ID is not correct.';
    ERROR_BAD_ARGUMENTS              : result := 'One or more arguments are not correct.';
    ERROR_BAD_PATHNAME               : result := 'The specified path is invalid.';
    ERROR_SIGNAL_PENDING             : result := 'A signal is already pending.';
    ERROR_MAX_THRDS_REACHED          : result := 'No more threads can be created in the system.';
    ERROR_LOCK_FAILED                : result := 'Unable to lock a region of a file.';
    ERROR_BUSY                       : result := 'The requested resource is in use.';
    ERROR_DEVICE_SUPPORT_IN_PROGRESS : result := 'Device''s command support detection is in progress.';
    ERROR_CANCEL_VIOLATION           : result := 'A lock request was not outstanding for the supplied cancel region.';
    ERROR_ATOMIC_LOCKS_NOT_SUPPORTED : result := 'The file system does not support atomic changes to the lock type.';
    ERROR_INVALID_SEGMENT_NUMBER     : result := 'The system detected a segment number that was not correct.';
    ERROR_INVALID_ORDINAL            : result := 'The operating system cannot run %1.';
    ERROR_ALREADY_EXISTS             : result := 'Cannot create a file when that file already exists.';
    ERROR_INVALID_FLAG_NUMBER        : result := 'The flag passed is not correct.';
    ERROR_SEM_NOT_FOUND              : result := 'The specified system semaphore name was not found.';
    ERROR_INVALID_STARTING_CODESEG   : result := 'The operating system cannot run %1.';
    ERROR_INVALID_STACKSEG           : result := 'The operating system cannot run %1.';
    ERROR_INVALID_MODULETYPE         : result := 'The operating system cannot run %1.';
    ERROR_INVALID_EXE_SIGNATURE      : result := 'Cannot run %1 in Win32 mode.';
    ERROR_EXE_MARKED_INVALID         : result := 'The operating system cannot run %1.';
    ERROR_BAD_EXE_FORMAT             : result := '%1 is not a valid Win32 application.';
    ERROR_ITERATED_DATA_EXCEEDS_64k  : result := 'The operating system cannot run %1.';
    ERROR_INVALID_MINALLOCSIZE       : result := 'The operating system cannot run %1.';
    ERROR_DYNLINK_FROM_INVALID_RING  : result := 'The operating system cannot run this application program.';
    ERROR_IOPL_NOT_ENABLED           : result := 'The operating system is not presently configured to run this application.';
    ERROR_INVALID_SEGDPL             : result := 'The operating system cannot run %1.';
    ERROR_AUTODATASEG_EXCEEDS_64k    : result := 'The operating system cannot run this application program.';
    ERROR_RING2SEG_MUST_BE_MOVABLE   : result := 'The code segment cannot be greater than or equal to 64K.';
    ERROR_RELOC_CHAIN_XEEDS_SEGLIM   : result := 'The operating system cannot run %1.';
    ERROR_INFLOOP_IN_RELOC_CHAIN     : result := 'The operating system cannot run %1.';
    ERROR_ENVVAR_NOT_FOUND           : result := 'The system could not find the environment option that was entered.';
    ERROR_NO_SIGNAL_SENT             : result := 'No process in the command subtree has a signal handler.';
    ERROR_FILENAME_EXCED_RANGE       : result := 'The filename or extension is too long.';
    ERROR_RING2_STACK_IN_USE         : result := 'The ring 2 stack is in use.';
    ERROR_META_EXPANSION_TOO_LONG    : result := 'The global filename characters, * or ?, are entered incorrectly or too many global filename characters are specified.';
    ERROR_INVALID_SIGNAL_NUMBER      : result := 'The signal being posted is not correct.';
    ERROR_THREAD_1_INACTIVE          : result := 'The signal handler cannot be set.';
    ERROR_LOCKED                     : result := 'The segment is locked and cannot be reallocated.';
    ERROR_TOO_MANY_MODULES           : result := 'Too many dynamic-link modules are attached to this program or dynamic-link module.';
    ERROR_NESTING_NOT_ALLOWED        : result := 'Cannot nest calls to LoadModule.';
    ERROR_EXE_MACHINE_TYPE_MISMATCH  : result := 'This version of %1 is not compatible with the version of Windows you''re running. Check your computer''s system information and then contact the software publisher.';
    ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY : result := 'The image file %1 is signed, unable to modify.';
    ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY : result := 'The image file %1 is strong signed, unable to modify.';
    ERROR_FILE_CHECKED_OUT           : result := 'This file is checked out or locked for editing by another user.';
    ERROR_CHECKOUT_REQUIRED          : result := 'The file must be checked out before saving changes.';
    ERROR_BAD_FILE_TYPE              : result := 'The file type being saved or retrieved has been blocked.';
    ERROR_FILE_TOO_LARGE             : result := 'The file size exceeds the limit allowed and cannot be saved.';
    ERROR_FORMS_AUTH_REQUIRED        : result := 'Access Denied. Before opening files in this location, you must first add the web site to your trusted sites list, browse to the web site, and select the option to login automatically.';
    ERROR_VIRUS_INFECTED             : result := 'Operation did not complete successfully because the file contains a virus or potentially unwanted software.';
    ERROR_VIRUS_DELETED              : result := 'This file contains a virus or potentially unwanted software and cannot be opened. Due to the nature of this virus or potentially unwanted software, the file has been removed from this location.';
    ERROR_PIPE_LOCAL                 : result := 'The pipe is local.';
    ERROR_BAD_PIPE                   : result := 'The pipe state is invalid.';
    ERROR_PIPE_BUSY                  : result := 'All pipe instances are busy.';
    ERROR_NO_DATA                    : result := 'The pipe is being closed.';
    ERROR_PIPE_NOT_CONNECTED         : result := 'No process is on the other end of the pipe.';
    ERROR_MORE_DATA                  : result := 'More data is available.';
    ERROR_VC_DISCONNECTED            : result := 'The session was canceled.';
    ERROR_INVALID_EA_NAME            : result := 'The specified extended attribute name was invalid.';
    ERROR_EA_LIST_INCONSISTENT       : result := 'The extended attributes are inconsistent.';
    WAIT_TIMEOUT                     : result := 'The wait operation timed out.';
    ERROR_NO_MORE_ITEMS              : result := 'No more data is available.';
    ERROR_CANNOT_COPY                : result := 'The copy functions cannot be used.';
    ERROR_DIRECTORY                  : result := 'The directory name is invalid.';
    ERROR_EAS_DIDNT_FIT              : result := 'The extended attributes did not fit in the buffer.';
    ERROR_EA_FILE_CORRUPT            : result := 'The extended attribute file on the mounted file system is corrupt.';
    ERROR_EA_TABLE_FULL              : result := 'The extended attribute table file is full.';
    ERROR_INVALID_EA_HANDLE          : result := 'The specified extended attribute handle is invalid.';
    ERROR_EAS_NOT_SUPPORTED          : result := 'The mounted file system does not support extended attributes.';
    ERROR_NOT_OWNER                  : result := 'Attempt to release mutex not owned by caller.';
    ERROR_TOO_MANY_POSTS             : result := 'Too many posts were made to a semaphore.';
    ERROR_PARTIAL_COPY               : result := 'Only part of a ReadProcessMemory or WriteProcessMemory request was completed.';
    ERROR_OPLOCK_NOT_GRANTED         : result := 'The oplock request is denied.';
    ERROR_INVALID_OPLOCK_PROTOCOL    : result := 'An invalid oplock acknowledgment was received by the system.';
    ERROR_DISK_TOO_FRAGMENTED        : result := 'The volume is too fragmented to complete this operation.';
    ERROR_DELETE_PENDING             : result := 'The file cannot be opened because it is in the process of being deleted.';
    ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING : result := 'Short name settings may not be changed on this volume due to the global registry setting.';
    ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME : result := 'Short names are not enabled on this volume.';
    ERROR_SECURITY_STREAM_IS_INCONSISTENT : result := 'The security stream for the given volume is in an inconsistent state. Please run CHKDSK on the volume.';
    ERROR_INVALID_LOCK_RANGE         : result := 'A requested file lock operation cannot be processed due to an invalid byte range.';
    ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT : result := 'The subsystem needed to support the image type is not present.';
    ERROR_NOTIFICATION_GUID_ALREADY_DEFINED : result := 'The specified file already has a notification GUID associated with it.';
    ERROR_INVALID_EXCEPTION_HANDLER  : result := 'An invalid exception handler routine has been detected.';
    ERROR_DUPLICATE_PRIVILEGES       : result := 'Duplicate privileges were specified for the token.';
    ERROR_NO_RANGES_PROCESSED        : result := 'No ranges for the specified operation were able to be processed.';
    ERROR_NOT_ALLOWED_ON_SYSTEM_FILE : result := 'Operation is not allowed on a file system internal file.';
    ERROR_DISK_RESOURCES_EXHAUSTED   : result := 'The physical resources of this disk have been exhausted.';
    ERROR_INVALID_TOKEN              : result := 'The token representing the data is invalid.';
    ERROR_DEVICE_FEATURE_NOT_SUPPORTED : result := 'The device does not support the command feature.';
    ERROR_MR_MID_NOT_FOUND           : result := 'The system cannot find message text for message number 0x%1 in the message file for %2.';
    ERROR_SCOPE_NOT_FOUND            : result := 'The scope specified was not found.';
    ERROR_UNDEFINED_SCOPE            : result := 'The Central Access Policy specified is not defined on the target machine.';
    ERROR_INVALID_CAP                : result := 'The Central Access Policy obtained from Active Directory is invalid.';
    ERROR_DEVICE_UNREACHABLE         : result := 'The device is unreachable.';
    ERROR_DEVICE_NO_RESOURCES        : result := 'The target device has insufficient resources to complete the operation.';
    ERROR_DATA_CHECKSUM_ERROR        : result := 'A data integrity checksum error occurred. Data in the file stream is corrupt.';
    ERROR_INTERMIXED_KERNEL_EA_OPERATION : result := 'An attempt was made to modify both a KERNEL and normal Extended Attribute (EA) in the same operation.';
    ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED : result := 'Device does not support file-level TRIM.';
    ERROR_OFFSET_ALIGNMENT_VIOLATION : result := 'The command specified a data offset that does not align to the device''s granularity/alignment.';
    ERROR_INVALID_FIELD_IN_PARAMETER_LIST : result := 'The command specified an invalid field in its parameter list.';
    ERROR_OPERATION_IN_PROGRESS      : result := 'An operation is currently in progress with the device.';
    ERROR_BAD_DEVICE_PATH            : result := 'An attempt was made to send down the command via an invalid path to the target device.';
    ERROR_TOO_MANY_DESCRIPTORS       : result := 'The command specified a number of descriptors that exceeded the maximum supported by the device.';
    ERROR_SCRUB_DATA_DISABLED        : result := 'Scrub is disabled on the specified file.';
    ERROR_NOT_REDUNDANT_STORAGE      : result := 'The storage device does not provide redundancy.';
    ERROR_RESIDENT_FILE_NOT_SUPPORTED : result := ' An operation is not supported on a resident file.';
    ERROR_COMPRESSED_FILE_NOT_SUPPORTED : result := 'An operation is not supported on a compressed file.';
    ERROR_DIRECTORY_NOT_SUPPORTED    : result := 'An operation is not supported on a directory.';
    ERROR_NOT_READ_FROM_COPY         : result := 'The specified copy of the requested data could not be read.';
    ERROR_FAIL_NOACTION_REBOOT       : result := 'No action was taken as a system reboot is required.';
    ERROR_FAIL_SHUTDOWN              : result := 'The shutdown operation failed.';
    ERROR_FAIL_RESTART               : result := 'The restart operation failed.';
    ERROR_MAX_SESSIONS_REACHED       : result := 'The maximum number of sessions has been reached.';
    ERROR_THREAD_MODE_ALREADY_BACKGROUND : result := 'The thread is already in background processing mode.';
    ERROR_THREAD_MODE_NOT_BACKGROUND : result := 'The thread is not in background processing mode.';
    ERROR_PROCESS_MODE_ALREADY_BACKGROUND : result := 'The process is already in background processing mode.';
    ERROR_PROCESS_MODE_NOT_BACKGROUND : result := 'The process is not in background processing mode.';
    ERROR_INVALID_ADDRESS            : result := 'Attempt to access invalid address.';
    534: result := 'Arithmetic results exceeding 32 bits.';
    535: result := 'There is a process at the other end of the canal.';
    536: result := 'The system waits for a process opens the other end of the canal.';
    994: result := 'Access to the extended attribute (EA) has been refused.';
    995: result := 'The operation of input / output has been abandoned due to the discontinuation of a thread or at the request of an application.';
    996: result := 'The input / output overlap is not in a reported condition.';
    997: result := 'An operation of input / output overlap is running.';
    998: result := 'Access to this memory location is invalid.';
    999: result := 'Error during a paging operation.';
    1001: result := 'Recursion too deep, stack overflowed.';
    1002: result := 'The window can not act on the message sent.';
    1003: result := 'Could not perform this function.';
    1004: result := 'Indicators invalid.';
    1005: result := 'The volume does not contain a file system known. Check that all file system drivers are loaded and necessary if the volume is not damaged.';
    1006: result := 'The open file is no longer valid because the volume that contains it has been damaged externally.';
    1007: result := 'The requested operation can not be performed in full screen mode.';
    1008: result := 'Attempt to reference a token that does not exist.';
    1009: result := 'The configuration registry is damaged.';
    1010: result := 'The registry configuration key is invalid.';
    1011: result := 'Unable to open registry configuration key.';
    1012: result := 'Unable to read registry configuration key.';
    1013: result := 'Could not write registry key configuration.';
    1014: result := 'One of the files in the Registry database has to be restored.';
    1114: result := 'An initialization routine of a dynamic library (DLL) failed.';
    1115: result := 'A system shutdown is in progress.';
    1116: result := 'The system is not being stopped, it is impossible to cancel the system shutdown.';
    1117: result := 'Unable to meet demand due to an error device I / O';
    1118: result := 'Failed to initialize the serial device. The serial driver will be unloaded.';
    1119: result := 'Unable to open a device that shares an interrupt (IRQ) with other devices. At least one other device that uses that IRQ was already opened.';
    1120: result := 'An operation of input / output port was completed by another write to the serial port. (The IOCTL_SERIAL_XOFF_COUNTER reached zero.)';
    1121: result := 'An operation of input / output port has been completed since the waiting period has expired. (The IOCTL_SERIAL_XOFF_COUNTER has not reached zero.)';
    1122: result := 'No sign of address ID has been found on the floppy.';
    1123: result := 'Discordance between the field ID of the disk sector address and track controller floppy drive.';
    1124: result := 'The floppy disk controller reported an error not recognized by the floppy disk driver.';
    1125: result := 'The floppy controller returned inconsistent results in its registers.';
    1126: result := 'While accessing the hard disk, a recalibrate operation failed despite several attempts.';
    1127: result := 'While accessing the hard disk, a disk operation failed even after several tests.';
    1128: result := 'While accessing the hard drive, reset the necessary disk controller has proved impossible.';
    1129: result := 'Meeting of the physical end of tape.';
    1130: result := 'Not enough memory on the server to process this command.';
    1131: result := 'A fatal embrace potential was detected.';
    1132: result := 'The base address or offset in the file is not properly aligned.';
    1140: result := 'attempt to change the power state of the system has encountered the veto of another application or another driver.';
    1141: result := 'The BIOS tried unsuccessfully to change the power state of the system.';
    1142: result := 'An attempt to create a number of links exceeds the maximum number allowed by the file system was made.';
    1150: result := 'The specified program requires a newer version of Windows.';
    1151: result := 'The specified program is not a Windows or MS-DOS.';
    1152: result := 'Unable to start multiple instances of the specified program.';
    1153: result := 'The specified program was written for an earlier version of Windows.';
    1154: result := 'One of the libraries required to run this application is damaged.';
    1155: result := 'No application is associated with the specified file for this operation.';
    1156: result := 'An error occurred while sending the command to the application.';
    1157: result := 'One of the libraries required to run this application can not be found.';
    1158: result := 'The current process has used all its share allocated by the system of descriptors for the objects of the Manager window.';
    1159: result := 'The message can be used only with synchronous operations.';
    1160: result := 'The indicated source element has no media.';
    1161: result := 'The indicated destination element already contains media.';
    1163: result := 'The indicated element is part of a magazine that is not present.';
    1164: result := 'The indicated device requires reinitialization due to errors.';
    1165: result := 'The device has indicated that cleaning is required before further operations are attempted.';
    1166: result := 'The device has indicated that its door is open.';
    1167: result := 'The device is not connected.';
    1168: result := 'Element not found.';
    1170: result := 'All the properties are not specified on the object.';
    1171: result := 'The past GetMouseMovePoints is not in the buffer.';
    1172: result := 'The tracking (workstation) is not running.';
    1173: result := 'identifier volume could not be found.';
    1175: result := 'Unable to delete the file to replace.';
    1176: result := 'Unable to move the replacement file to the file replace. The file to be replaced has retained its original name.';
    1177: result := 'Unable to move the replacement file to the file replace. To replace the file has been renamed using the backup name.';
    1178: result := 'Theamendment to the log volume is being removed.';
    1179: result := 'amendment to the log volume is not active.';
    1180: result := 'A file was found, but it is perhaps not the correct file.';
    1181: result := 'The log entry has been removed from the newspaper.';
    1200: result := 'The specified device name is invalid.';
    1201: result := 'device is not currently connected but it is a stored connection.';
    1202: result := 'The local device name has a remembered connection to another network resource.';
    1203: result := 'No network accepted the given network path.';
    1204: result := 'The network software name specified is invalid.';
    1205: result := 'Unable to open network connection profile.';
    1206: result := 'The network connection profile is damaged.';
    1207: result := 'Unable to enumerate an object that is not a container.';
    1208: result := 'An extended error has occurred.';
    1209: result := 'The format of the specified group name is invalid.';
    1210: result := 'The format of the computer name specified is invalid.';
    1211: result := 'The format of the specified event name is invalid.';
    1212: result := 'The format of the domain name specified is invalid.';
    1213: result := 'The format of the service name specified is invalid.';
    1214: result := 'The format of the specified network name is invalid.';
    1215: result := 'The format of the specified share name is invalid.';
    1216: result := 'The format of the specified password is invalid.';
    1217: result := 'The format of the specified message name is invalid.';
    1218: result := 'The format of the specified message destination is invalid.';
    1219: result := 'Several connections to a server or a shared resource by the same user, using more than one user name are not allowed. Remove all previous connections to the server or shared resource and try again.';
    1220: result := 'attempt to establish a session with a network server took place while the maximum number of sessions on this server was already outdated.';
    1221: result := 'The name of the workgroup or domain is already in use by another computer on the network.';
    1222: result := 'Either there is no network, the network has not started.';
    1223: result := 'The operation was canceled by the user.';
    1224: result := 'The requested operation could not be performed on a file with a user mapped section open.';
    1225: result := 'The remote system refused the network connection.';
    1226: result := 'The network connection was gracefully closed.';
    1227: result := 'The endpoint of the transport network has an address associated with it.';
    1228: result := 'An address has not yet been associated with the network termination point.';
    1229: result := 'An operation was attempted on a network connection that does not exist.';
    1230: result := 'An invalid operation was attempted on an active network connection.';
    1231: result := 'The network location can not be achieved. For information concerning the resolution of problems of the network, see Windows Help.';
    1232: result := 'The network location can not be achieved. For information concerning the resolution of problems of the network, see Windows Help.';
    1233: result := 'The network location can not be achieved. For information concerning the resolution of problems of the network, see Windows Help.';
    1234: result := 'No service operates on the network termination point of destination of the remote system.';
    1235: result := 'The request was aborted.';
    1236: result := 'The network connection was adopted by the local system.';
    1237: result := 'The operation could not be completed. A new test should be performed.';
    1238: result := 'A connection to the server could not be performed because the maximum number of simultaneous connections has been reached.';
    1811: result := 'The server is in use and can not be unloaded.';
    1812: result := 'The specified image file did not contain a resource section.';
    1813: result := 'The specified resource type can be found in the image file.';
    1814: result := 'The specified resource name can not be found in the image file.';
    1815: result := 'The language ID specified resource can be found in the image file.';
    1816: result := 'insufficient quota available to process this command.';
    1817: result := 'No interfaces have been registered.';
    1818: result := 'The remote procedure call was canceled.';
    1819: result := 'The connection handle does not contain all the necessary information.';
    1820: result := 'failed communication when calling a remote procedure.';
    1821: result := 'The requested authentication level is not supported.';
    1822: result := 'No principal name said.';
    1823: result := 'The error specified is not an error code Windows RPC correct.';
    1824: result := 'A UUID identifier that is valid only on this computer has been allocated.';
    1825: result := 'An error specific security package has occurred.';
    1826: result := 'Thread not canceled.';
    1827: result := 'Operation invalid handle the encoding / decoding.';
    1828: result := 'Incompatible version of the serializing package.';
    1829: result := 'Incompatible version of the RPC stub.';
    1830: result := 'The RPC channel object is invalid or corrupted.';
    1831: result := 'An invalid operation was attempted on an object given RPC channel.';
    1832: result := 'The version of the RPC channel is not supported.';
    1898: result := 'The group member was not found.';
    1899: result := 'Unable to create the entry of the database of the endpoint mapper.';
    1900: result := 'The universal unique identifier of the object (UUID) is invalid UUID.';
    1901: result := 'The specified time is invalid.';
    1902: result := 'The specified form name is invalid.';
    1903: result := 'The specified form size is invalid.';
    1904: result := 'Someone is already waiting on the descriptor specified printer.';
    1905: result := 'The specified printer was deleted.';
    1906: result := 'The printer status is not valid.';
    1907: result := 'The password of the user must be changed before opening a session for the first time.';
    1908: result := 'Unable to find a domain controller for this domain.';
    1909: result := 'The referenced account is currently locked and may not be possible to connect to it.';
    1910: result := 'The object exporter specified was not found';
    1911: result := 'The object specified was not found.';
    1912: result := 'The solver object specified.';
    1913: result := 'The rest of the data to be sent in the buffer request.';
    1914: result := 'Handle remote procedure call asynchronous invalid.';
    1915: result := 'Handle for asynchronous RPC call invalid for this operation.';
    1916: result := 'The RPC channel object has already been closed.';
    1917: result := 'The RPC call was completed before the channels are treated.';
    1918: result := 'No more data available in the RPC channel.';
    1919: result := 'No site name is available for this computer.';
    1920: result := 'The system can not access the file.';
    1921: result := 'The file name can not be solved by the system.';
    1922: result := 'The entry type is incorrect.';
    1923: result := 'Unable to export all objects UUID to the specified entry.';
    1924: result := 'Unable to export the interface to the specified entry.';
    1925: result := 'Unable to add the specified profile.';
    else result := 'Unknown Error (' + IntToStr(win32_Error_Code) + ')!';
  end;
end;

end.

Kontakt

Udo Schmal
Udo Schmal

Udo Schmal
Softwareentwickler
Ellerndiek 26
24837 Schleswig
Schleswig-Holstein
Germany




+49 4621 9785538
+49 1575 0663676
+49 4621 9785539
SMS
WhatsApp

Google Maps Profile
Instagram Profile
vCard 2.1, vCard 3.0, vCard 4.0

Service Infos

CMS Info

Product Name:
UDOs Webserver
Version:
0.5.1.217
Description:
All in one Webserver
Copyright:
Udo Schmal
Compilation:
Sun, 10. Nov 2024 00:22:34

Development Info

Compiler:
Free Pascal FPC 3.3.1
compiled for:
OS:Linux, CPU:x86_64

System Info

OS:
Ubuntu 22.04.5 LTS (Jammy Jellyfish)

Hardware Info

Model:
Hewlett-Packard HP Pavilion dm4 Notebook PC
CPU Name:
Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz
CPU Type:
x86_64, 1 physical CPU(s), 2 Core(s), 4 logical CPU(s),  MHz