본문 바로가기

코드82

[Win32] 드라이버 파일 Resource에 포함시키기 참고:http://www.Rootkit.com 루트킷 같은 성격의 드라이버들은 배포시 아래와 같은 방법으로 실행 바이너리의 리소스에 드라이버를 포함시킨다. 리소스 추가 -> 가져오기( 드라이버 파일) -> 사용자 지정 리소스 탐색 (ex:Driver) 와 같이 추가를 하면 아래의 그림처럼 바이너리가 추가된다. 그 후 Build를 하면 내가 포함 시킨 드라이버 파일과 Resource.h 파일이 수정된다. 아래의 IDR_DRIVER1의 선언해준 "DRIVER"를 통해 리소스를 추출하면 된다. BOOL ExtractDriver(LPSTR Path) { HRSRC RsH; HGLOBAL RsGH; BYTE *FilePtr; ULONG FileSize; ULONG numWritten; HANDLE hFile; R.. 2008. 11. 26.
[WIN3232] 프로세스 간 통신 ( named Pip 사용 ) [클라이언트] #include #include #include #include #define BUFSIZE 512 int _tmain(int argc, TCHAR *argv[]) { HANDLE hPipe; LPTSTR lpvMessage=TEXT("Default message from client"); TCHAR chBuf[BUFSIZE]; BOOL fSuccess; DWORD cbRead, cbWritten, dwMode; LPTSTR lpszPipename = TEXT("\\\\.\\pipe\\mynamedpipe"); if( argc > 1 ) lpvMessage = argv[1]; // Try to open a named pipe; wait for it, if necessary. while (1.. 2008. 11. 13.
[WDK] IoCreateDevice IoCreateDevice The IoCreateDevice routine creates a device object for use by a driver. NTSTATUS IoCreateDevice( IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName OPTIONAL, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject ); Parameters DriverObject Pointer to the driver object for the caller.. 2008. 11. 12.
[C/C++] 가변 인자 사용하기 int vsprintf_s( char *buffer, size_t sizeInBytes, const char *format, va_list argptr ); // crt_vsprintf_s.c // This program uses vsprintf_s to write to a buffer. // The size of the buffer is determined by _vscprintf. #include #include void test( char * format, ... ) { va_list args; int len; char * buffer; va_start( args, format ); len = _vscprintf( format, args ) // _vscprintf doesn't count + 1;.. 2008. 11. 4.
함수 확실하게 사용하자. DeskHandle = GetDesktopWindow(); FindWindowEx( DeskHandle , SubHandle , ClassName, NULL); Msdn엔 'If hwndParent is NULL, the function uses the desktop window as the parent window.' 이렇게 나와있으나.. Winapi을 몇일 밖에 안만져본 나로써.. Null로 사용했을 sub 핸들을 못찾는 문제의 빈도가 종종 생긴다. 왜 그런지..ㅡㅡ;; 이왕 사용할 함수 확실하게 사용하자.!! 2008. 10. 31.
[WDM] Device Driver -CodeProject- http://www.codeproject.com/system/driverdev.asp http://www.codeproject.com/system/driverdev2.asp http://www.codeproject.com/system/driverdev3.asp http://www.codeproject.com/system/driverdev4asp.asp http://www.codeproject.com/system/driverdev5asp.asp 2008. 10. 31.