본문 바로가기

Hacking/Windows API

GetComputerName 함수

BOOL GetComputerNameA(
  LPSTR   lpBuffer,
  LPDWORD nSize
);

컴퓨터 이름을 가져오는 함수

 

- lpBuffer

컴퓨터의 이름이 저장될 변수

 

- nSize

컴퓨터의 이름이 저장될 변수의 크기

 

ex code

#include <windows.h>
#include <stdio.h>

int main()
{
    char buffer[256] = "";
    DWORD size = sizeof(buffer);
    if (GetComputerName(buffer, &size))
    {
        printf("ComputerName: %s\n", buffer);
    }
}

 

출처 - https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getcomputernamea

         https://gist.github.com/davidglezz/7307425

'Hacking > Windows API' 카테고리의 다른 글

VirtualProtect 함수  (0) 2020.11.28
CreateFile 함수  (0) 2020.03.21
CreateThread 함수  (0) 2020.03.15