Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[Func] Microsoft error code translation


  • Please log in to reply
2 replies to this topic
Rseding91
  • Members
  • 699 posts
  • Last active: Mar 19 2014 03:55 PM
  • Joined: 07 Jun 2010
This function will return the correct error message for microsoft error codes 0-499 or blank if it doesn't have a error message for the number given.

It's meant to be used in conjunction with the "GetLastError" dllcall.


If anyone wants them I can build the same type of function for any of the other error ranges (500-15999) listed here: <!-- m -->http://msdn.microsof... ... p/ms681381<!-- m -->

Lookup_MSError(_ErrorNumber){
	Static 0 := "The operation completed successfully.", 1 := "Incorrect function.", 2 := "The system cannot find the file specified."
	Static 3 := "The system cannot find the path specified.", 4 := "The system cannot open the file.", 5 := "Access is denied."
	Static 6 := "The handle is invalid.", 7 := "The storage control blocks were destroyed.", 8 := "Not enough storage is available to process this command."
	Static 9 := "The storage control block address is invalid.", 10 := "The environment is incorrect.", 11 := "An attempt was made to load a program with an incorrect format."
	Static 12 := "The access code is invalid.", 13 := "The data is invalid.", 14 := "Not enough storage is available to complete this operation."
	Static 15 := "The system cannot find the drive specified.", 16 := "The directory cannot be removed.", 17 := "The system cannot move the file to a different disk drive."
	Static 18 := "There are no more files.", 19 := "The media is write protected.", 20 := "The system cannot find the device specified."
	Static 21 := "The device is not ready.", 22 := "The device does not recognize the command.", 23 := "Data error (cyclic redundancy check)."
	Static 24 := "The program issued a command but the command length is incorrect.", 25 := "The drive cannot locate a specific area or track on the disk.", 26 := "The specified disk or diskette cannot be accessed."
	Static 27 := "The drive cannot find the sector requested.", 28 := "The printer is out of paper.", 29 := "The system cannot write to the specified device."
	Static 30 := "The system cannot read from the specified device.", 31 := "A device attached to the system is not functioning.", 32 := "The process cannot access the file because it is being used by another process."
	Static 33 := "The process cannot access the file because another process has locked a portion of the file.", 34 := "The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1.", 36 := "Too many files opened for sharing."
	Static 38 := "Reached the end of the file.", 39 := "The disk is full.", 50 := "The request is not supported."
	Static 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."
	Static 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."
	Static 53 := "The network path was not found.", 54 := "The network is busy.", 55 := "The specified network resource or device is no longer available."
	Static 56 := "The network BIOS command limit has been reached.", 57 := "A network adapter hardware error occurred.", 58 := "The specified server cannot perform the requested operation."
	Static 59 := "An unexpected network error occurred.", 60 := "The remote adapter is not compatible.", 61 := "The printer queue is full."
	Static 62 := "Space to store the file waiting to be printed is not available on the server.", 63 := "Your file waiting to be printed was deleted.", 64 := "The specified network name is no longer available."
	Static 65 := "Network access is denied.", 66 := "The network resource type is not correct.", 67 := "The network name cannot be found."
	Static 68 := "The name limit for the local computer network adapter card was exceeded.", 69 := "The network BIOS session limit was exceeded.", 70 := "The remote server has been paused or is in the process of being started."
	Static 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."
	Static 72 := "The specified printer or disk device has been paused.", 80 := "The file exists.", 82 := "The directory or file cannot be created."
	Static 83 := "Fail on INT 24.", 84 := "Storage to process this request is not available.", 85 := "The local device name is already in use."
	Static 86 := "The specified network password is not correct.", 87 := "The parameter is incorrect.", 88 := "A write fault occurred on the network."
	Static 89 := "The system cannot start another process at this time.", 100 := "Cannot create another system semaphore.", 101 := "The exclusive semaphore is owned by another process."
	Static 102 := "The semaphore is set and cannot be closed.", 103 := "The semaphore cannot be set again.", 104 := "Cannot request exclusive semaphores at interrupt time."
	Static 105 := "The previous ownership of this semaphore has ended.", 106 := "Insert the diskette for drive %1.", 107 := "The program stopped because an alternate diskette was not inserted."
	Static 108 := "The disk is in use or locked by another process.", 109 := "The pipe has been ended.", 110 := "The system cannot open the device or file specified."
	Static 111 := "The file name is too long.", 112 := "There is not enough space on the disk.", 113 := "No more internal file identifiers available."
	Static 114 := "The target internal file identifier is incorrect.", 117 := "The IOCTL call made by the application program is not correct.", 118 := "The verify-on-write switch parameter value is not correct."
	Static 119 := "The system does not support the command requested.", 120 := "This function is not supported on this system.", 121 := "The semaphore timeout period has expired."
	Static 122 := "The data area passed to a system call is too small.", 123 := "The filename, directory name, or volume label syntax is incorrect.", 124 := "The system call level is not correct."
	Static 125 := "The disk has no volume label.", 126 := "The specified module could not be found.", 127 := "The specified procedure could not be found."
	Static 128 := "There are no child processes to wait for.", 129 := "The %1 application cannot be run in Win32 mode.", 130 := "Attempt to use a file handle to an open disk partition for an operation other than raw disk I/O."
	Static 131 := "An attempt was made to move the file pointer before the beginning of the file.", 132 := "The file pointer cannot be set on the specified device or file.", 133 := "A JOIN or SUBST command cannot be used for a drive that contains previously joined drives."
	Static 134 := "An attempt was made to use a JOIN or SUBST command on a drive that has already been joined.", 135 := "An attempt was made to use a JOIN or SUBST command on a drive that has already been substituted.", 136 := "The system tried to delete the JOIN of a drive that is not joined."
	Static 137 := "The system tried to delete the substitution of a drive that is not substituted.", 138 := "The system tried to join a drive to a directory on a joined drive.", 139 := "The system tried to substitute a drive to a directory on a substituted drive."
	Static 140 := "The system tried to join a drive to a directory on a substituted drive.", 141 := "The system tried to SUBST a drive to a directory on a joined drive.", 142 := "The system cannot perform a JOIN or SUBST at this time."
	Static 143 := "The system cannot join or substitute a drive to or for a directory on the same drive.", 144 := "The directory is not a subdirectory of the root directory.", 145 := "The directory is not empty."
	Static 146 := "The path specified is being used in a substitute.", 147 := "Not enough resources are available to process this command.", 148 := "The path specified cannot be used at this time."
	Static 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."
	Static 150 := "System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.", 151 := "The number of specified semaphore events for DosMuxSemWait is not correct.", 152 := "DosMuxSemWait did not execute; too many semaphores are already set."
	Static 153 := "The DosMuxSemWait list is not correct.", 154 := "The volume label you entered exceeds the label character limit of the target file system.", 155 := "Cannot create another thread."
	Static 156 := "The recipient process has refused the signal.", 157 := "The segment is already discarded and cannot be locked.", 158 := "The segment is already unlocked."
	Static 159 := "The address for the thread ID is not correct.", 160 := "One or more arguments are not correct.", 161 := "The specified path is invalid."
	Static 162 := "A signal is already pending.", 164 := "No more threads can be created in the system.", 167 := "Unable to lock a region of a file."
	Static 170 := "The requested resource is in use.", 171 := "The device's command support detection is in progress.", 173 := "A lock request was not outstanding for the supplied cancel region."
	Static 174 := "The file system does not support atomic changes to the lock type.", 180 := "The system detected a segment number that was not correct.", 182 := "The operating system cannot run %1."
	Static 183 := "Cannot create a file when that file already exists.", 186 := "The flag passed is not correct.", 187 := "The specified system semaphore name was not found."
	Static 188 := "The operating system cannot run %1.", 189 := "The operating system cannot run %1.", 190 := "The operating system cannot run %1."
	Static 191 := "Cannot run %1 in Win32 mode.", 192 := "The operating system cannot run %1.", 193 := "%1 is not a valid Win32 application."
	Static 194 := "The operating system cannot run %1.", 195 := "The operating system cannot run %1.", 196 := "The operating system cannot run this application program."
	Static 197 := "The operating system is not presently configured to run this application.", 198 := "The operating system cannot run %1.", 199 := "The operating system cannot run this application program."
	Static 200 := "The code segment cannot be greater than or equal to 64K.", 201 := "The operating system cannot run %1.", 202 := "The operating system cannot run %1."
	Static 203 := "The system could not find the environment option that was entered.", 205 := "No process in the command subtree has a signal handler.", 206 := "The filename or extension is too long."
	Static 207 := "The ring 2 stack is in use."
	Static 208 := "The global filename characters, * or ?, are entered incorrectly or too many global filename characters are specified."
	Static 209 := "The signal being posted is not correct.", 210 := "The signal handler cannot be set.", 212 := "The segment is locked and cannot be reallocated."
	Static 214 := "Too many dynamic-link modules are attached to this program or dynamic-link module.", 215 := "Cannot nest calls to LoadModule."
	Static 216 := "The version of %1 is not compatible with the version you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher."
	Static 217 := "The image file %1 is signed, unable to modify.", 218 := "The image file %1 is strong signed, unable to modify.", 220 := "This file is checked out or locked for editing by another user."
	Static 221 := "The file must be checked out before saving changes.", 222 := "The file type being saved or retrieved has been blocked.", 223 := "The file size exceeds the limit allowed and cannot be saved."
	Static 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."
	Static 225 := "Operation did not complete successfully because the file contains a virus or potentially unwanted software."
	Static 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."
	Static 229 := "The pipe is local.", 230 := "The pipe state is invalid.", 231 := "All pipe instances are busy."
	Static 232 := "The pipe is being closed.", 233 := "No process is on the other end of the pipe.", 234 := "More data is available."
	Static 240 := "The session was canceled.", 254 := "The specified extended attribute name was invalid.", 255 := "The extended attributes are inconsistent."
	Static 258 := "The wait operation timed out.", 259 := "No more data is available.", 266 := "The copy functions cannot be used."
	Static 267 := "The directory name is invalid.", 275 := "The extended attributes did not fit in the buffer.", 276 := "The extended attribute file on the mounted file system is corrupt."
	Static 277 := "The extended attribute table file is full.", 278 := "The specified extended attribute handle is invalid.", 282 := "The mounted file system does not support extended attributes."
	Static 288 := "Attempt to release mutex not owned by caller.", 298 := "Too many posts were made to a semaphore.", 299 := "Only part of a ReadProcessMemory or WriteProcessMemory request was completed."
	Static 300 := "The oplock request is denied.", 301 := "An invalid oplock acknowledgment was received by the system.", 302 := "The volume is too fragmented to complete this operation."
	Static 303 := "The file cannot be opened because it is in the process of being deleted.", 304 := "Short name settings may not be changed on this volume due to the global registry setting.", 305 := "Short names are not enabled on this volume."
	Static 306 := "The security stream for the given volume is in an inconsistent state. Please run CHKDSK on the volume."
	Static 307 := "A requested file lock operation cannot be processed due to an invalid byte range.", 308 := "The subsystem needed to support the image type is not present.", 309 := "The specified file already has a notification GUID associated with it."
	Static 310 := "An invalid exception handler routine has been detected.", 311 := "Duplicate privileges were specified for the token.", 312 := "No ranges for the specified operation were able to be processed."
	Static 313 := "Operation is not allowed on a file system internal file.", 314 := "The physical resources of this disk have been exhausted.", 315 := "The token representing the data is invalid."
	Static 316 := "The device does not support the command feature.", 317 := "The system cannot find message text for message number 0x%1 in the message file for %2.", 318 := "The scope specified was not found."
	Static 319 := "The Central Access Policy specified is not defined on the target machine.", 320 := "The Central Access Policy obtained from Active Directory is invalid.", 321 := "The device is unreachable."
	Static 322 := "The target device has insufficient resources to complete the operation.", 323 := "A data integrity checksum error occurred. Data in the file stream is corrupt."
	Static 324 := "An attempt was made to modify both a SECURE and normal Extended Attribute (EA) in the same operation."
	Static 325 := "Data was read from the specified copy.", 326 := "Repair for the requested range should be deferred.", 327 := "The command specified a data offset that does not align to the device's granularity/alignment."
	Static 328 := "The command specified an invalid field in its parameter list.", 329 := "An operation is currently in progress with the device.", 330 := "An attempt was made to send down the command via an invalid path to the target device."
	Static 331 := "The command specified a number of descriptors that exceeded the maximum supported by the device.", 332 := "Scrub is disabled on the specified file.", 350 := "No action was taken as a system reboot is required."
	Static 351 := "The shutdown operation failed.", 352 := "The restart operation failed.", 353 := "The maximum number of sessions has been reached."
	Static 400 := "The thread is already in background processing mode.", 401 := "The thread is not in background processing mode.", 402 := "The process is already in background processing mode."
	Static 403 := "The process is not in background processing mode.", 487 := "Attempt to access invalid address."
	
	If _ErrorNumber Is Not Number
		Return "Invalid error number"
	
	Error := %_ErrorNumber%
	Return Error ? Error : ""
}


JSLover
  • Members
  • 920 posts
  • Last active: Nov 02 2012 09:54 PM
  • Joined: 20 Dec 2004
Before you break something, typing up 16000 error msgs...:shock:...let me inform you of the FormatMessage() WinAPI function. If used with the FORMAT_MESSAGE_FROM_SYSTEM flag, it will get the error msg for any GetLastError() number.

I've actually planned on writing this up, but I haven't yet.

Also, I think someone else on the forum might've already written a function using this method...
Function to retreive string of "A_LastError" - Thalon's Post
Function to retreive string of "A_LastError" - majkinetor's Post

Rseding91
  • Members
  • 699 posts
  • Last active: Mar 19 2014 03:55 PM
  • Joined: 07 Jun 2010
Interesting :)

I didn't write up the function myself :p I just wrote a parser to parse the MSDN page and generate the function for me.