comparison src/process-nt.c @ 647:b39c14581166

[xemacs-hg @ 2001-08-13 04:45:47 by ben] removal of unsigned, size_t, etc.
author ben
date Mon, 13 Aug 2001 04:46:48 +0000
parents 373ced43e288
children fdefd0186b75
comparison
equal deleted inserted replaced
646:00c54252fe4f 647:b39c14581166
115 * kernel32.dll, so the allocated memory is freed just by resuming the 115 * kernel32.dll, so the allocated memory is freed just by resuming the
116 * thread, which immediately terminates after that. 116 * thread, which immediately terminates after that.
117 */ 117 */
118 118
119 static int 119 static int
120 alloc_process_memory (HANDLE h_process, size_t size, 120 alloc_process_memory (HANDLE h_process, Memory_Count size,
121 process_memory* pmc) 121 process_memory* pmc)
122 { 122 {
123 LPTHREAD_START_ROUTINE adr_ExitThread = 123 LPTHREAD_START_ROUTINE adr_ExitThread =
124 (LPTHREAD_START_ROUTINE) 124 (LPTHREAD_START_ROUTINE)
125 GetProcAddress (GetModuleHandle ("kernel32"), "ExitThread"); 125 GetProcAddress (GetModuleHandle ("kernel32"), "ExitThread");
187 * Return the value returned by ROUTINE, or (DWORD)-1 if call failed. 187 * Return the value returned by ROUTINE, or (DWORD)-1 if call failed.
188 */ 188 */
189 static DWORD 189 static DWORD
190 run_in_other_process (HANDLE h_process, 190 run_in_other_process (HANDLE h_process,
191 LPTHREAD_START_ROUTINE routine, 191 LPTHREAD_START_ROUTINE routine,
192 LPVOID data, size_t data_size) 192 LPVOID data, Memory_Count data_size)
193 { 193 {
194 process_memory pm; 194 process_memory pm;
195 const size_t code_size = FRAGMENT_CODE_SIZE; 195 const Memory_Count code_size = FRAGMENT_CODE_SIZE;
196 /* Need at most 3 extra bytes of memory, for data alignment */ 196 /* Need at most 3 extra bytes of memory, for data alignment */
197 size_t total_size = code_size + data_size + 3; 197 Memory_Count total_size = code_size + data_size + 3;
198 LPVOID remote_data; 198 LPVOID remote_data;
199 HANDLE h_thread; 199 HANDLE h_thread;
200 DWORD dw_unused; 200 DWORD dw_unused;
201 201
202 /* Allocate memory */ 202 /* Allocate memory */
1056 Bufbyte chunkbuf[512]; 1056 Bufbyte chunkbuf[512];
1057 Bytecount chunklen; 1057 Bytecount chunklen;
1058 1058
1059 while (1) 1059 while (1)
1060 { 1060 {
1061 Lstream_data_count writeret; 1061 Lstream_Data_Count writeret;
1062 1062
1063 chunklen = Lstream_read (lstream, chunkbuf, 512); 1063 chunklen = Lstream_read (lstream, chunkbuf, 512);
1064 if (chunklen <= 0) 1064 if (chunklen <= 0)
1065 break; /* perhaps should abort() if < 0? 1065 break; /* perhaps should abort() if < 0?
1066 This should never happen. */ 1066 This should never happen. */