unsigned long GetCurrentFileName(__out wchar_t* pPath, __inout size_t nPathLength, __out wchar_t* pFileName, __inout size_t nFileNameLength)

{

unsigned long ulError = ERROR_SUCCESS;


//------------------------------------------------------------------

// [ 

wchar_t szFilePath[MAX_PATH] = {0, };

wchar_t szDrive[_MAX_DRIVE] = {0, };

wchar_t szDir[_MAX_DIR] = {0, };

wchar_t szFName[_MAX_FNAME] = {0, };

wchar_t szExt[_MAX_EXT] = {0, };


if (pPath == NULL || nPathLength == 0 || pFileName == NULL || nFileNameLength == 0)

{

ulError = ERROR_INVALID_PARAMETER;

DEBUGPRINT(_T("invalid paramter."));

goto $error;

}


if (0 == GetModuleFileName(NULL, szFilePath, _countof(szFilePath)))

{

ulError = GetLastError();


DEBUGPRINT(_T("get module file name error(%d)"), ulError);


goto $error;

}


if (0 != _wsplitpath_s(szFilePath, szDrive, _countof(szDrive), szDir, _countof(szDir),

  szFName, _countof(szFName), szExt, _countof(szExt)))

{

ulError = errno;


DEBUGPRINT(_T("split path error(%d)"), ulError);


goto $error;

}


ZeroMemory(szFilePath, _countof(szFilePath));


if (0 != _wmakepath_s(szFilePath, _countof(szFilePath), szDrive, szDir, szFName, szExt))

{

ulError = errno;


DEBUGPRINT(_T("make path error(%d)"), ulError);


goto $error;

}


ZeroMemory(pPath, nPathLength);


if (0 != _wmakepath_s(pPath, nPathLength, szDrive, szDir, NULL, NULL))

{

ulError = errno;


DEBUGPRINT(_T("make path error(%d)"), ulError);


goto $error;

}


nPathLength = wcslen(pPath);


ZeroMemory(pFileName, nFileNameLength);


if (0 != _wmakepath_s(pFileName, nFileNameLength, NULL, NULL, szFName, szExt))

{

ulError = errno;


DEBUGPRINT(_T("make path error(%d)"), ulError);


goto $error;

}


nFileNameLength = wcslen(pFileName);


$error:


// ]

//------------------------------------------------------------------


return ulError;

}

Posted by superrmoon
,

1. 환경

- Local : windows 7 x64

- VirtualBox : ubuntu server 64bit

- 로컬 영역 : 내부망

- 무선 영역 : 외부망


2. VirtualBox Network 설정

- 어댑터1 : 브리지 어댑터 (Wireless)



- 어댑터2 : 호스트 전용 어댑터 (모뎀 : VitualBox Host-Only Ethernet Adapter)



3. 로컬 네트워크 설정

- VirtualBox Host-Only Network



3. ubuntu network interface 설정

~# vi /etc/network/interfaces


# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).


source /etc/network/interfaces.d/*


# The loopback network interface

auto lo

iface lo inet loopback


# The primary network interface

auto enp0s3

iface enp0s3 inet dhcp


auto enp0s8

iface enp0s8 inet static

address 192.168.100.100

netmask 255.255.255.0

#gateway 192.168.100.1


~# /etc/init.d/networking restart


enp0s8 에 gateway를 설정하면 외부망 연결이 안됨.

Posted by superrmoon
,