[x32dbg/x64dbg/Ghidra] Windows API Function Parameter Analysis 윈도우 API 함수 매개변수 분석
Reverse Engineering 2025. 7. 26. 09:39 |윈도우 API 함수 파라미터를 분석해 보자.

파일을 처음 임포트해서 분석할 때 옵션에서 선택할 수도 있다.




윈도우 API 함수 파라미터를 분석해 보자.

파일을 처음 임포트해서 분석할 때 옵션에서 선택할 수도 있다.




기드라에서 디스어셈블되지 않고 Opcode로 표시된 명령을 디스어셈블하고 함수로 등록해 보자.


Disassemble(Restricted), Disassemble(Static)은 한 줄(혹은 블럭으로 지정된 부분)만 디스어셈블한다.






| WinDbg Memory Window Variable Address (0) | 2023.05.03 |
|---|---|
| WinDbg 설치 하고 심볼 경로 설정하기(feat. 심볼 강제 로드) (0) | 2023.04.29 |
| [Ghidra] Binary Patching 바이너리 패치 (0) | 2023.04.06 |
| [Ghidra] Dark Theme 다크 테마 (0) | 2023.02.10 |
| Cheat Engine Cuphead Character HP Cheating - 치트 엔진 컵헤드 HP 치팅 (0) | 2023.01.28 |
Test class declares Change() as a friend function and it accesses the private member variable 'a'.
아래 코드에서 Test 클래스는 Change라는 friend 함수를 선언 하고 멤버 변수 a에 접근한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include <iostream> using namespace std; class Test { private: int a; public: Test() { a = 0; } ~Test() { } void Show() { cout << "a: " << a << endl; } friend void Change(Test& t, int c); }; void Change(Test& t, int c) { t.a = c; } int main(int argc, char* argv[]) { Test t; t.Show(); Change(t, 10); t.Show(); return 0; } | cs |
How to set default arguments in a friend function?
friend 함수 Change에 디폴트 매개 변수를 설정하고 싶다면 어떻게 해야 할까?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include <iostream> using namespace std; class Test { private: int a; public: Test() { a = 0; } ~Test() { } void Show() { cout << "a: " << a << endl; } friend void Change(Test& t, int c = 100); }; void Change(Test& t, int c) { t.a = c; } int main(int argc, char* argv[]) { Test t; t.Show(); Change(t, 10); t.Show(); return 0; } | cs |
Setting default arguments in the friend function declaration will cause an error message like below.
위 코드와 같이 friend 선언부에 디폴트 매개 변수를 설정 하면 별 문제 없이 빌드는 되지만 아래와 같은 메세지가 나타나게 된다.
friend declaration cannot add default arguments to previous declaration
Try to set default arguments in the function definition.
아래와 같이 함수 정의부에 디폴트 매개 변수를 설정 하면 에러 메세지가 나타나지 않는다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include <iostream> using namespace std; class Test { private: int a; public: Test() { a = 0; } ~Test() { } void Show() { cout << "a: " << a << endl; } friend void Change(Test& t, int c); }; void Change(Test& t, int c = 100) { t.a = c; } int main(int argc, char* argv[]) { Test t; t.Show(); Change(t, 10); t.Show(); return 0; } | cs |
Or, you can declare and define the friend function and set the default arguments at once.
아니면 friend 함수 선언부에서 함수 정의까지 작성하고 매개 변수를 설정해 준다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include <iostream> using namespace std; class Test { private: int a; public: Test() { a = 0; } ~Test() { } void Show() { cout << "a: " << a << endl; } friend void Change(Test& t, int c = 100) { t.a = c; } }; int main(int argc, char* argv[]) { Test t; t.Show(); Change(t, 10); t.Show(); return 0; } | cs |
<Result>
| Sending a mouse input 마우스 입력 보내기 (0) | 2019.10.28 |
|---|---|
| Sending a keyboard input 키 입력 보내기 (0) | 2019.10.27 |
| Integrated Color Picker for Visual Studio IDE and Editor (0) | 2019.07.05 |
| How to open a command prompt on the project's path in Visual Studio (2) | 2019.07.03 |
| How to make a game save file editor 간단한 게임 에디터 만들기 (1) | 2019.06.30 |