1 |
//$Header$ |
//$Header$ |
2 |
//------------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------------- |
3 |
//This file is part of "kicker", a program for spawning threads and/or processes periodically in |
//This file is part of "kicker", a program for spawning threads periodically in order to |
4 |
//order to unstall certain Windows programs and scripts. The cause of the stall is unknown, but |
//unstall certain Windows programs and scripts. The cause of the stall is unknown, but |
5 |
//it is known that spawning threads and/or processes unstalls the system. |
//it is known that spawning threads unstalls the system. |
6 |
//------------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------------- |
7 |
//This source code and any program in which it is compiled/used is provided under the MIT License, |
//This source code and any program in which it is compiled/used is provided under the MIT License, |
8 |
//reproduced below. |
//reproduced below. |
25 |
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
26 |
//SOFTWARE. |
//SOFTWARE. |
27 |
//------------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------------- |
|
#include <assert.h> |
|
|
#include <malloc.h> |
|
28 |
#include <process.h> |
#include <process.h> |
29 |
#include <stdio.h> |
#include <stdio.h> |
30 |
#include <string.h> |
#include <string.h> |
|
#include <time.h> |
|
31 |
#include <windows.h> |
#include <windows.h> |
32 |
|
|
33 |
#define NELEM(A) (sizeof(A)/sizeof(A[0])) |
#define NELEM(A) (sizeof(A)/sizeof(A[0])) |
34 |
|
|
35 |
void emit_hline_std(void) |
void emit_hline_std(void) |
36 |
{ |
{ |
37 |
printf("----------------------------------------------------------------------------------\n"); |
printf("-------------------------------------------------------------------------------\n"); |
38 |
} |
} |
39 |
|
|
40 |
void emit_mit_license(void) |
void emit_mit_license(void) |
41 |
{ |
{ |
42 |
const char *ref[] = |
const char *ref[] = |
43 |
{ |
{ |
44 |
"Permission is hereby granted, free of charge, to any person obtaining a copy of", |
"Permission is hereby granted, free of charge, to any person obtaining a copy", |
45 |
"this software and associated documentation files(the \"Software\"), to deal in the", |
"of this software and associated documentation files(the \"Software\"), to", |
46 |
"Software without restriction, including without limitation the rights to use,", |
"deal in the Software without restriction, including without limitation the", |
47 |
"copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the", |
"rights to use, copy, modify, merge, publish, distribute, sublicense, and / or", |
48 |
"Software, and to permit persons to whom the Software is furnished to do so,", |
"sell copies of the Software, and to permit persons to whom the Software is", |
49 |
"subject to the following conditions :", |
"furnished to do so, subject to the following conditions :", |
50 |
"", |
"", |
51 |
"The above copyright notice and this permission notice shall be included in all", |
"The above copyright notice and this permission notice shall be included in", |
52 |
"copies or substantial portions of the Software.", |
"all copies or substantial portions of the Software.", |
53 |
"", |
"", |
54 |
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR", |
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR", |
55 |
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", |
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", |
116 |
//CTRL-C or CTRL-BREAK. |
//CTRL-C or CTRL-BREAK. |
117 |
volatile int thread_ran = 0; //volatile because shared with thread. |
volatile int thread_ran = 0; //volatile because shared with thread. |
118 |
|
|
|
|
|
119 |
BOOL CtrlHandler(DWORD fdwCtrlType) |
BOOL CtrlHandler(DWORD fdwCtrlType) |
120 |
{ |
{ |
121 |
switch (fdwCtrlType) |
switch (fdwCtrlType) |
133 |
//blow up and wipe out several city blocks! |
//blow up and wipe out several city blocks! |
134 |
} |
} |
135 |
|
|
|
|
|
136 |
//Thread function. Parameter ignored. |
//Thread function. Parameter ignored. |
137 |
DWORD WINAPI MyThreadFunction(LPVOID lpParam) |
DWORD WINAPI MyThreadFunction(LPVOID lpParam) |
138 |
{ |
{ |
141 |
return (0); |
return (0); |
142 |
} |
} |
143 |
|
|
|
|
|
144 |
int c_main(int argc, char* argv[]) |
int c_main(int argc, char* argv[]) |
145 |
{ |
{ |
146 |
size_t selector = NELEM(kickish_words) - 1; |
size_t selector = NELEM(kickish_words) - 1; |
152 |
emit_hline_std(); |
emit_hline_std(); |
153 |
printf("kicker, Copyright 2016 David T. Ashley (dashley@gmail.com)\n"); |
printf("kicker, Copyright 2016 David T. Ashley (dashley@gmail.com)\n"); |
154 |
emit_hline_std(); |
emit_hline_std(); |
155 |
printf("This program is provided under the MIT License, reproduced below.\n"); |
printf("This program is made available under the MIT License, reproduced below.\n"); |
156 |
emit_hline_std(); |
emit_hline_std(); |
157 |
emit_mit_license(); |
emit_mit_license(); |
158 |
emit_hline_std(); |
emit_hline_std(); |