Skip to content

Commit 9854f7f

Browse files
ValerioNeriGitandreabac3
authored andcommitted
windows added -h option
1 parent 90b9edf commit 9854f7f

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

main.c

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ int main(int argc, char *argv[]) {
9595
// Create named pipe
9696
//DWORD dwWritten;
9797

98-
9998
hNamedPipe = CreateNamedPipe(TEXT("\\\\.\\pipe\\PipeHandleRequest"),
10099
PIPE_ACCESS_DUPLEX,
101100
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, // FILE_FLAG_FIRST_PIPE_INSTANCE is not needed but forces CreateNamedPipe(..) to fail if the pipe already exists...

main_HandleRequest.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626

2727

2828
int main(int argc, char *argv[]) {
29-
printf("I am handle request.exe, my args are: %s %s %s %s %s", argv[0], argv[1], argv[2], argv[3], argv[4]);
29+
printf("I am handle request.exe, my args are: %s %s %s %s %s", argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
3030
struct Configs h_configs;
3131
h_configs.port_number = atoi(argv[1]);
3232
h_configs.mode_concurrency = argv[3][0];
3333
if (strlen(argv[2]) > BUFFER_SIZE) { return -1; }
3434
strcpy(h_configs.root_dir, argv[2]);
3535
printf("I am handle request.exe, my args are: %s %d %s %d", argv[0], h_configs.port_number, h_configs.root_dir,
3636
h_configs.mode_concurrency);
37-
37+
DOS_PROTECTION = atoi(argv[5]);
3838
struct ThreadArgs h_args;
3939
h_args.configs = h_configs;
4040
h_args.ip_client = argv[0];

windows/lib/socket/windows_socket.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ void run_process(struct ThreadArgs *args, SOCKADDR_IN *clientAddr, SOCKET client
6767
si.cb = sizeof(si);
6868

6969
char cmd_child[BUFFER_SIZE * 2] = {0};
70-
snprintf(cmd_child, BUFFER_SIZE * 2, "%s %d \"%s\" %d %s", inet_ntoa(clientAddr->sin_addr), configs->port_number,
71-
configs->root_dir, configs->mode_concurrency, ip_buffer);
70+
snprintf(cmd_child, BUFFER_SIZE * 2, "%s %d \"%s\" %d %s %d", inet_ntoa(clientAddr->sin_addr), configs->port_number,
71+
configs->root_dir, configs->mode_concurrency, ip_buffer, DOS_PROTECTION);
7272
fprintf(stderr, "cmd child %s\n", cmd_child);
7373

7474
if (FALSE ==

0 commit comments

Comments
 (0)