annotate flappyufo/win32/wrapper.c @ 11:78390e0e674f

remove DPF
author prymula <prymula76@outlook.com>
date Thu, 08 Feb 2024 20:21:56 +0100
parents 0c50890ef159
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
prymula <prymula76@outlook.com>
parents:
diff changeset
1 #include <windows.h>
prymula <prymula76@outlook.com>
parents:
diff changeset
2 #include <stdio.h>
prymula <prymula76@outlook.com>
parents:
diff changeset
3 #include <tchar.h>
prymula <prymula76@outlook.com>
parents:
diff changeset
4 #include <stdlib.h> // exit
prymula <prymula76@outlook.com>
parents:
diff changeset
5 #include <unistd.h> // sleep access
prymula <prymula76@outlook.com>
parents:
diff changeset
6
prymula <prymula76@outlook.com>
parents:
diff changeset
7 char * file_exist(){
prymula <prymula76@outlook.com>
parents:
diff changeset
8 char * name = (char *)".\\config.txt";
prymula <prymula76@outlook.com>
parents:
diff changeset
9 //char *file = current(name);
prymula <prymula76@outlook.com>
parents:
diff changeset
10 char *file = name;
prymula <prymula76@outlook.com>
parents:
diff changeset
11
prymula <prymula76@outlook.com>
parents:
diff changeset
12 if (access(file, F_OK)==0){
prymula <prymula76@outlook.com>
parents:
diff changeset
13 printf("PLIK istnieje %s\n",file);
prymula <prymula76@outlook.com>
parents:
diff changeset
14 //free(file);
prymula <prymula76@outlook.com>
parents:
diff changeset
15 return file;
prymula <prymula76@outlook.com>
parents:
diff changeset
16 }
prymula <prymula76@outlook.com>
parents:
diff changeset
17 printf("PLIK nie istnieje %s\n",file);
prymula <prymula76@outlook.com>
parents:
diff changeset
18 //free(file);
prymula <prymula76@outlook.com>
parents:
diff changeset
19 return NULL;
prymula <prymula76@outlook.com>
parents:
diff changeset
20 }
prymula <prymula76@outlook.com>
parents:
diff changeset
21
prymula <prymula76@outlook.com>
parents:
diff changeset
22
prymula <prymula76@outlook.com>
parents:
diff changeset
23
prymula <prymula76@outlook.com>
parents:
diff changeset
24
5
0c50890ef159 flappyufo-0.230919-1
prymula <prymula76@outlook.com>
parents: 0
diff changeset
25 void _main( int argc, TCHAR *argv[] )
0
prymula <prymula76@outlook.com>
parents:
diff changeset
26 {
prymula <prymula76@outlook.com>
parents:
diff changeset
27 STARTUPINFO si;
prymula <prymula76@outlook.com>
parents:
diff changeset
28 PROCESS_INFORMATION pi;
prymula <prymula76@outlook.com>
parents:
diff changeset
29
prymula <prymula76@outlook.com>
parents:
diff changeset
30 char * file = file_exist();
prymula <prymula76@outlook.com>
parents:
diff changeset
31 char bufor1[128];
prymula <prymula76@outlook.com>
parents:
diff changeset
32 char bufor2[128];
prymula <prymula76@outlook.com>
parents:
diff changeset
33 char bufor3[128];
prymula <prymula76@outlook.com>
parents:
diff changeset
34 char run[384];
prymula <prymula76@outlook.com>
parents:
diff changeset
35
prymula <prymula76@outlook.com>
parents:
diff changeset
36 if (!file) exit(1);
prymula <prymula76@outlook.com>
parents:
diff changeset
37
prymula <prymula76@outlook.com>
parents:
diff changeset
38 FILE * f = fopen(file, "r");
prymula <prymula76@outlook.com>
parents:
diff changeset
39 fscanf(f, "%s %s %s", bufor1,bufor2,bufor3);
prymula <prymula76@outlook.com>
parents:
diff changeset
40 fclose(f);
prymula <prymula76@outlook.com>
parents:
diff changeset
41 strcpy(run, bufor1);
prymula <prymula76@outlook.com>
parents:
diff changeset
42 strcat(run, " ");
prymula <prymula76@outlook.com>
parents:
diff changeset
43 strcat(run, bufor2);
prymula <prymula76@outlook.com>
parents:
diff changeset
44 strcat(run, " ");
prymula <prymula76@outlook.com>
parents:
diff changeset
45 strcat(run, bufor3);
prymula <prymula76@outlook.com>
parents:
diff changeset
46 printf("Uruchamiam %s \n",run);
prymula <prymula76@outlook.com>
parents:
diff changeset
47 //free(file);
prymula <prymula76@outlook.com>
parents:
diff changeset
48
prymula <prymula76@outlook.com>
parents:
diff changeset
49
prymula <prymula76@outlook.com>
parents:
diff changeset
50 ZeroMemory( &si, sizeof(si) );
prymula <prymula76@outlook.com>
parents:
diff changeset
51 si.cb = sizeof(si);
prymula <prymula76@outlook.com>
parents:
diff changeset
52 ZeroMemory( &pi, sizeof(pi) );
prymula <prymula76@outlook.com>
parents:
diff changeset
53
prymula <prymula76@outlook.com>
parents:
diff changeset
54 //if( argc != 2 )
prymula <prymula76@outlook.com>
parents:
diff changeset
55 //{
prymula <prymula76@outlook.com>
parents:
diff changeset
56 // printf("Usage: %s [cmdline]\n", argv[0]);
prymula <prymula76@outlook.com>
parents:
diff changeset
57 // return;
prymula <prymula76@outlook.com>
parents:
diff changeset
58 //}
prymula <prymula76@outlook.com>
parents:
diff changeset
59
prymula <prymula76@outlook.com>
parents:
diff changeset
60 // Start the child process.
prymula <prymula76@outlook.com>
parents:
diff changeset
61 if( !CreateProcess( NULL, // No module name (use command line)
prymula <prymula76@outlook.com>
parents:
diff changeset
62 run, // Command line
prymula <prymula76@outlook.com>
parents:
diff changeset
63 NULL, // Process handle not inheritable
prymula <prymula76@outlook.com>
parents:
diff changeset
64 NULL, // Thread handle not inheritable
prymula <prymula76@outlook.com>
parents:
diff changeset
65 FALSE, // Set handle inheritance to FALSE
prymula <prymula76@outlook.com>
parents:
diff changeset
66 0, // No creation flags
prymula <prymula76@outlook.com>
parents:
diff changeset
67 NULL, // Use parent's environment block
prymula <prymula76@outlook.com>
parents:
diff changeset
68 NULL, // Use parent's starting directory
prymula <prymula76@outlook.com>
parents:
diff changeset
69 &si, // Pointer to STARTUPINFO structure
prymula <prymula76@outlook.com>
parents:
diff changeset
70 &pi ) // Pointer to PROCESS_INFORMATION structure
prymula <prymula76@outlook.com>
parents:
diff changeset
71 )
prymula <prymula76@outlook.com>
parents:
diff changeset
72 {
prymula <prymula76@outlook.com>
parents:
diff changeset
73 printf( "CreateProcess failed (%d).\n", GetLastError() );
prymula <prymula76@outlook.com>
parents:
diff changeset
74 return;
prymula <prymula76@outlook.com>
parents:
diff changeset
75 }
prymula <prymula76@outlook.com>
parents:
diff changeset
76
prymula <prymula76@outlook.com>
parents:
diff changeset
77 // Wait until child process exits.
prymula <prymula76@outlook.com>
parents:
diff changeset
78 WaitForSingleObject( pi.hProcess, INFINITE );
prymula <prymula76@outlook.com>
parents:
diff changeset
79
prymula <prymula76@outlook.com>
parents:
diff changeset
80 // Close process and thread handles.
prymula <prymula76@outlook.com>
parents:
diff changeset
81 CloseHandle( pi.hProcess );
prymula <prymula76@outlook.com>
parents:
diff changeset
82 CloseHandle( pi.hThread );
prymula <prymula76@outlook.com>
parents:
diff changeset
83 }