Document directory
- 1. PAL-specific Entry Points
- 2. File System
- 3. Memory Management
- 4. synchronous/asynchronous IO
- Threading
- Networking
- Exception
- CRT (C Runtime)
- Postscript:
PAL = Platform Abstract Layer, which is the dependency of the. Net Platform on the specific operating system level, mainly including
- Start and end
- File System
- Memory Management
- Synchronous I/O
- Asynchronous I/O
- Threading
- Networking
- Exception Handling
- Debugging support
- CRT (C Runtime Library)
1. PAL-specific Entry Points
The so-called PAL-specific Entry Points refers to the interface defined by the PAL layer, such as start and end. It includes the following methods:
Method Name |
Explanation |
PAL_Initialize |
- 0 is returned when the call is successful, and other values are returned when the call fails. It is best to prompt the error message.
- PAL needs to provide the exit and ExitProcess Methods
- CreateThread method to create a process
|
PAL_Terminate |
- If PAL_Initialize is successful, execute PAL_Terminate.
- After the PAL_Terminate call is complete, if the PAL client is less than 0, it will jump to exit and ExitProcess
|
PAL_GetUserConfigurationDirectoryW |
Returns the Setting data of the corresponding user. |
PAL_RegisterLibraryPAL_UnregisterLibrary |
Register the lib dll file (lpLibFileName) in DLLMain) |
PAL_GetPALDirectoryW |
Obtain the directory where the PAL dll runs. For example, c: \ Rotor \ v1.x86chk. rotor \ rotor_pal.dll returns c: \ Rotor \ v1.x86chk. rotor |
PAL_Random |
Random Number Generation. 1. lpBuffer: used to obtain random bytes. 2. bStrong: used to identify random numbers with additional strength, for example, Key |
PAL_get_stdout/PAL_get_stdin/PAL_get_stderr |
Corresponding stdout, stdin, and stderr methods of the system |
PAL_errno |
Returns a pointer to the corresponding thread error code. |
PAL_LocalHandleToRemote/PAL_RemoteHandleToLocal |
Pointer to mutex, process, and eventReturned value: INVALID_HANDLE_VALUE/Handle value or Type |
2. File System
Taking the PAL layer of a UNIX system as an example, there are five types of operations on the file system.
- File Operations
- Operations on directories
- Read disk Information
PALIMPORT BOOL PALAPI GetDiskFreeSpaceW( LPCWSTR lpDirectoryName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, /* Caller will ignore output value */ LPDWORD lpTotalNumberOfClusters) /* Caller will ignore output value */
- Search for files
Path operations
3. Memory Management
Local: Local Memory Management Heap: Heap-based memory management shared memory: the so-called shared memory means that different processes use the same copy. For example, program B uses. dll, and C is also, so B and C have shared memory. the shared memory also contains the copy-on-write and synchronization parts.
4. synchronous/asynchronous IO
Debug
Threading
Code name |
Function |
Process. h |
Process operations |
Thread. h |
Thread operations |
Localstorage. c |
Some basic operations of string, such as contact and copy |
Seamphore. c |
Semaphores |
Mutex. c |
Mutex |
Event. h/event. c |
Event |
Critsect. c |
CRITICAL_SECTION |
Wait. c |
|
Networking
Soket Communication Mechanism
Asynchronous Communication: Async. c
Exception
SEH-Structure ubuntuin Handler
CRT (C Runtime)
Code name |
Function |
File. c |
Operations on files, basic operations on files in C Language |
Finite. h |
Support for floating point numbers, infinity, and infinity |
Lstr |
Some basic operations of string, such as contact and copy |
Mbstring. c |
Multi-bytes string |
Misc. c |
Interaction with the running environment, such as char * MiscGetenv (const char * name) |
Path. c |
Path operations |
Printf. c |
Corresponding OS output |
Silent_printf.c |
Corresponding Trace Output TODO: Verify this |
String. c |
Common Operations corresponding to string, comare, _ swab, PAL_strtoul, PAL_atol... |
Thread. c |
PAL_exit |
Wchar. c |
Contains operations on char and string. |
Postscript:
What involves the PAL level naturally involves a lot of operating system knowledge. Due to the concentration of knowledge and the limitations of personal energy, a detailed explanation is not provided for the time being. If you are interested and competent, thank you for your advice. Thank you.