diff --git a/system/computer_name.c b/system/computer_name.c new file mode 100644 index 0000000..621d2b1 --- /dev/null +++ b/system/computer_name.c @@ -0,0 +1,19 @@ +#include +#include + +int wmain(void) { + + wchar_t computerName[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD size = sizeof(computerName) / sizeof(computerName[0]); + + int r = GetComputerNameW(computerName, &size); + + if (r == 0) { + wprintf(L"Failed to get computer name %ld", GetLastError()); + return 1; + } + + wprintf(L"Computer name: %ls\n", computerName); + + return 0; +}