#include <windows.h>
#include <stdio.h>
#include <string.h>
void Error(){
MessageBox(0, "Error!!!", "Warning", MB_OK);
printf("Operation Failed!!!\n");
exit(1);
}
-------------------
/*
int main(){
char Name[20]={0};
char fName[30]={0};
DWORD dw;
HANDLE hFile;
printf("input Create File name : ");
gets(Name);
hFile=CreateFile(Name, GENERIC_READ | GENERIC_WRITE, 0,0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,0);
if(hFile==INVALID_HANDLE_VALUE) Error();
printf("Create COmplete!\n");
printf("input Program Name or Path : ");
gets(fName);
if(!WriteFile(hFile, fName, strlen(fName), &dw, 0)) Error();
printf("input Complete!\n");
CloseHandle(hFile);
return 0;
}
*/
-------------------
int main(){
char Name[20]={0};
char Buffer[30]={0};
DWORD dw;
HANDLE hFile;
printf("input File name : ");
gets(Name);
hFile=CreateFile(Name, GENERIC_READ | GENERIC_WRITE, 0,0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,0);
if(!ReadFile (hFile, Buffer, sizeof(Buffer), &dw, 0)) Error();
//hFile -> 열었던 파일의 handle값
ShellExecute(NULL,"open",Buffer,0,0, SW_SHOW); //여러가지 기능이 있는 ShellExcute()
printf("Operation Complete !!\n");
CloseHandle(hFile);
return 0;
}
-> 많이 쓰니 외워 두는게 좋음
-> 우클릭 후 search for
---------
'Reversing' 카테고리의 다른 글
The usages of loadLibrary() for making dll and function pointer (0) | 2014.10.15 |
---|---|
Anti-debugging (0) | 2014.10.14 |
crackme and win32API (0) | 2014.10.08 |
packing (0) | 2014.10.07 |
packing and unpacking using (0) | 2014.10.06 |