Main function of test process.
25{
26 HANDLE PipeHandle;
29 char * Buffer;
30
31 if (argc != 2)
32 {
33 printf("you should not test functionalities directly, instead use 'test' "
34 "command from HyperDbg...\n");
35 return 1;
36 }
37
39
40 if (!Buffer)
41 {
42 printf("err, could not allocate communication buffer\n");
43 _getch();
44 return 1;
45 }
46
49
50 if (!strcmp(
argv[1],
"im-hyperdbg"))
51 {
52
53
54
55
56
57
58
60
61 if (!PipeHandle)
62 {
63
64
65
66 free(Buffer);
67
68 printf("err, unable to create handle\n");
69 _getch();
70 return 1;
71 }
72
73 SentMessageResult =
75
76 if (!SentMessageResult)
77 {
78
79
80
81 free(Buffer);
82
83 printf("err, unable to send message\n");
84 _getch();
85 return 1;
86 }
87
89
90 if (!ReadBytes)
91 {
92
93
94
95 free(Buffer);
96
97 printf("err, unable to read message\n");
98 _getch();
99 return 1;
100 }
101
102 if (strcmp(Buffer,
103 "Hello, Dear Test Process... Yes, I'm HyperDbg Debugger :)") ==
104 0)
105 {
106
107
108
109
110
111
112
114
115 strcpy_s(
116 Buffer,
118 "Wow! I miss you... Would you plz send test cases?");
119
120 SentMessageResult =
122
123 if (!SentMessageResult)
124 {
125
126
127
128 free(Buffer);
129
130 printf("err, sending error\n");
131 _getch();
132 return 1;
133 }
134
135
136
137
140
141 if (!ReadBytes)
142 {
143
144
145
146 free(Buffer);
147
148 printf("err, nothing to read\n");
149 _getch();
150 return 1;
151 }
152
153
154
155
156
158 printf("!!!! Read to run the test cases !!!!");
159 _getch();
160
161
162
163
165
166
167
168
169 exit(0);
170 }
171 }
172 else
173 {
174 printf("you should not test functionalities directly, instead use 'test' "
175 "command from HyperDbg...\n");
176
177 free(Buffer);
178 return 1;
179 }
180
181 free(Buffer);
182 return 0;
183}
UCHAR BOOLEAN
Definition BasicTypes.h:39
unsigned int UINT32
Definition BasicTypes.h:48
#define TEST_CASE_MAXIMUM_BUFFERS_TO_COMMUNICATE
Maximum buffer to communicate between debugger and debuggee process.
Definition Definition.h:60
UINT32 NamedPipeClientReadMessage(HANDLE PipeHandle, char *BufferToRead, int MaximumSizeOfBuffer)
Definition namedpipe.cpp:268
HANDLE NamedPipeClientCreatePipe(LPCSTR PipeName)
Create a client named pipe.
Definition namedpipe.cpp:179
VOID NamedPipeClientClosePipe(HANDLE PipeHandle)
close named pipe handle of client
Definition namedpipe.cpp:302
BOOLEAN NamedPipeClientSendMessage(HANDLE PipeHandle, char *BufferToSend, int BufferSize)
send client message over named pipe
Definition namedpipe.cpp:225
char ** argv
Definition symbol-parser.h:46