module.c

来自「SimpleGraphicOperatingSystem 32位图形化操作系统 」· C语言 代码 · 共 53 行

C
53
字号
#include <api.h>
#include <stdio.h>
#include <windows.h>


//Load Library
HMODULE WINAPI LoadLibrary(
  LPCTSTR lpFileName
){
    return KLoadLibrary( lpFileName, 1 );
}


//GetProcAddress
void* WINAPI GetProcAddress(
  HMODULE hModule,
  LPCSTR lpProcName //If this parameter is an ordinal value, 
  //it must be in the low-order word; the high-order word must be zero. 
){
    return KGetProcAddress( hModule, lpProcName );
}


//获得模块的名
DWORD WINAPI GetModuleFileNameA(
  HMODULE hModule,      //If hModule is NULL, return the executable file of current process
  LPTSTR lpFilename,
  DWORD nSize
){
    printf("GetModuleFileName hModule: %x nSize:%d\n", hModule, nSize );
    strcpy(lpFilename, "none" );
    return 4; //length of lpFilename
}

//获得模块的名(Unicode)
DWORD WINAPI GetModuleFileNameW(
  HMODULE hModule,      //If hModule is NULL, return the executable file of current process
  LPTSTR lpFilename,
  DWORD nSize
){
    printf("GetModuleFileName hModule: %x nSize:%d\n", hModule, nSize );
}

//返回一个加载的模块的句柄
HMODULE WINAPI GetModuleHandleA(
  LPCTSTR lpModuleName  //if NULL, return the module to the file used to create the calling process 
){
    printf("GetModuleHandleA lpModuleName:%s\n", lpModuleName );
    HMODULE hModule = KGetModule( lpModuleName );
    return hModule;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?