Changeset 1507
- Timestamp:
- 01/13/08 22:39:58 (8 months ago)
- Files:
-
- libemu/trunk/include/emu/emu_hashtable.h (modified) (1 diff)
- libemu/trunk/include/emu/environment/emu_profile.h (modified) (3 diffs)
- libemu/trunk/include/emu/environment/linux/emu_env_linux.h (modified) (1 diff)
- libemu/trunk/src/emu_hashtable.c (modified) (3 diffs)
- libemu/trunk/src/emu_stack.c (modified) (1 diff)
- libemu/trunk/src/environment/emu_profile.c (modified) (14 diffs)
- libemu/trunk/src/environment/linux/emu_env_linux.c (modified) (1 diff)
- libemu/trunk/src/environment/win32/emu_env_w32.c (modified) (1 diff)
- libemu/trunk/src/environment/win32/env_w32_dll_export_kernel32_hooks.c (modified) (11 diffs)
- libemu/trunk/src/environment/win32/env_w32_dll_export_urlmon_hooks.c (modified) (2 diffs)
- libemu/trunk/src/environment/win32/env_w32_dll_export_ws2_32_hooks.c (modified) (5 diffs)
- libemu/trunk/testsuite/sctest.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libemu/trunk/include/emu/emu_hashtable.h
r1317 r1507 61 61 62 62 struct emu_hashtable_bucket_item *emu_hashtable_bucket_item_new(void *key, void *value); 63 63 void emu_hashtable_bucket_item_free(struct emu_hashtable_bucket_item *ehbi); 64 64 65 65 struct emu_hashtable_bucket libemu/trunk/include/emu/environment/emu_profile.h
r1505 r1507 36 36 enum emu_profile_argument_render 37 37 { 38 render_ref, 38 render_none, 39 render_ptr, 39 40 render_int, 40 41 render_struct, … … 65 66 struct 66 67 { 67 struct emu_profile_argument * ref;68 struct emu_profile_argument *ptr; 68 69 uint32_t addr; 69 }t ref;70 }tptr; 70 71 } value; 71 72 … … 111 112 void emu_profile_debug(struct emu_profile *profile); 112 113 void emu_profile_function_debug(struct emu_profile_function *function); 114 115 void emu_profile_argument_add_none(struct emu_profile *profile); 113 116 void emu_profile_argument_add_int(struct emu_profile *profile, char *argtype, char *argname, int value); 114 117 void emu_profile_argument_add_string(struct emu_profile *profile, char *argtype, char *argname, char *value); 115 void emu_profile_argument_add_ ref(struct emu_profile *profile, char *argtype, char *argname, uint32_t value);118 void emu_profile_argument_add_ptr(struct emu_profile *profile, char *argtype, char *argname, uint32_t value); 116 119 void emu_profile_argument_add_ip(struct emu_profile *profile, char *argtype, char *argname, uint32_t value); 117 120 void emu_profile_argument_add_port(struct emu_profile *profile, char *argtype, char *argname, uint32_t value); 118 121 119 122 void emu_profile_function_add(struct emu_profile *profile, char *fnname); 120 void emu_profile_argument_st art(struct emu_profile* profile, const char* structtype, const char* structname);121 void emu_profile_argument_ end(struct emu_profile *profile);123 void emu_profile_argument_struct_start(struct emu_profile* profile, const char* structtype, const char* structname); 124 void emu_profile_argument_struct_end(struct emu_profile *profile); 122 125 123 126 libemu/trunk/include/emu/environment/linux/emu_env_linux.h
r1442 r1507 48 48 49 49 struct emu_env_linux *emu_env_linux_new(struct emu *e); 50 void emu_ linux_free(struct emu_env_linux *eel);50 void emu_env_linux_free(struct emu_env_linux *eel); 51 51 52 52 struct emu_env_linux_syscall *emu_env_linux_syscall_check(struct emu_env_linux *env); libemu/trunk/src/emu_hashtable.c
r1317 r1507 70 70 if ((ehb = eh->buckets[i]) != NULL) 71 71 { 72 for (ehbi = emu_hashtable_bucket_items_first(ehb->items); !emu_hashtable_bucket_items_attail(ehbi); ehbi = emu_hashtable_bucket_items_next(ehbi)) 72 73 while ((ehbi = emu_hashtable_bucket_items_remove_first(ehb->items)) != NULL) 73 74 { 74 75 if (eh->key_destructor != NULL) … … 80 81 eh->value_destructor(ehbi->item.value); 81 82 } 83 emu_hashtable_bucket_item_free(ehbi); 82 84 } 83 85 … … 203 205 return ehbi; 204 206 } 207 208 209 void emu_hashtable_bucket_item_free(struct emu_hashtable_bucket_item *ehbi) 210 { 211 free(ehbi); 212 } libemu/trunk/src/emu_stack.c
r1505 r1507 64 64 return NULL; 65 65 66 struct emu_stack_item *item = es->front; 66 67 void *data = es->front->data; 67 68 es->front = es->front->next; 69 free(item); 68 70 return data; 69 71 } libemu/trunk/src/environment/emu_profile.c
r1505 r1507 29 29 #include <stdlib.h> 30 30 #include <stdio.h> 31 #include <netinet/in.h> 32 #include <arpa/inet.h> 33 #include <sys/types.h> 34 #include <sys/socket.h> 35 31 36 32 37 #include "emu/environment/emu_profile.h" … … 49 54 void emu_profile_free(struct emu_profile *profile) 50 55 { 51 56 struct emu_profile_function *function; 57 while ((function = emu_profile_functions_remove_first(profile->functions)) != NULL) 58 { 59 emu_profile_function_free(function); 60 } 61 emu_profile_functions_destroy(profile->functions); 62 emu_stack_free(profile->argument_stack); 63 free(profile); 52 64 } 53 65 … … 79 91 }else 80 92 { 81 profile->last_ref->value.t ref.ref= argument;93 profile->last_ref->value.tptr.ptr = argument; 82 94 profile->last_ref = NULL; 83 95 } … … 85 97 86 98 87 void emu_profile_argument_st art(struct emu_profile* profile, const char* structtype, const char* structname)99 void emu_profile_argument_struct_start(struct emu_profile* profile, const char* structtype, const char* structname) 88 100 { 89 101 // printf("%s %s\n", __PRETTY_FUNCTION__, structname); … … 98 110 99 111 100 void emu_profile_argument_ end(struct emu_profile *profile)112 void emu_profile_argument_struct_end(struct emu_profile *profile) 101 113 { 102 114 // printf("%s %s\n", __PRETTY_FUNCTION__); … … 105 117 106 118 119 void emu_profile_argument_add_none(struct emu_profile *profile) 120 { 121 struct emu_profile_argument *argument = emu_profile_argument_new(render_none, "", ""); 122 emu_profile_argument_add(profile, argument); 123 } 124 107 125 void emu_profile_argument_add_int(struct emu_profile *profile, char *argtype, char *argname, int value) 108 126 { … … 121 139 } 122 140 123 void emu_profile_argument_add_ ref(struct emu_profile *profile, char *argtype, char *argname, uint32_t value)124 { 125 struct emu_profile_argument *argument = emu_profile_argument_new(render_ ref, argtype, argname);126 argument->value.t ref.addr = value;141 void emu_profile_argument_add_ptr(struct emu_profile *profile, char *argtype, char *argname, uint32_t value) 142 { 143 struct emu_profile_argument *argument = emu_profile_argument_new(render_ptr, argtype, argname); 144 argument->value.tptr.addr = value; 127 145 emu_profile_argument_add(profile, argument); 128 146 profile->last_ref = argument; … … 157 175 { 158 176 177 struct emu_profile_argument *argument; 178 while ((argument = emu_profile_arguments_remove_first(function->arguments)) != NULL ) 179 { 180 emu_profile_argument_free(argument); 181 } 182 183 if (function->fnname != NULL) 184 free(function->fnname); 185 186 emu_profile_arguments_destroy(function->arguments); 187 free(function); 159 188 } 160 189 … … 167 196 168 197 emu_profile_arguments_init_link(argument); 169 argument->argname = strdup(name); 170 argument->argtype = strdup(type); 198 if ( render != render_none ) 199 { 200 argument->argname = strdup(name); 201 argument->argtype = strdup(type); 202 } 171 203 argument->render = render; 172 204 … … 181 213 void emu_profile_argument_free(struct emu_profile_argument *argument) 182 214 { 183 215 if (argument->argname != NULL) 216 free(argument->argname); 217 218 if (argument->argtype != NULL) 219 free(argument->argtype); 220 221 switch(argument->render) 222 { 223 case render_port: 224 case render_ip: 225 case render_none: 226 case render_int: 227 break; 228 229 case render_string: 230 if (argument->value.tchar != NULL) 231 free(argument->value.tchar); 232 break; 233 234 case render_ptr: 235 emu_profile_argument_free(argument->value.tptr.ptr); 236 break; 237 238 case render_struct: 239 { 240 struct emu_profile_argument *argumentit; 241 while ((argumentit = emu_profile_arguments_remove_first(argument->value.tstruct.arguments)) != NULL ) 242 { 243 emu_profile_argument_free(argumentit); 244 } 245 246 emu_profile_arguments_destroy(argument->value.tstruct.arguments); 247 } 248 break; 249 } 250 251 free(argument); 184 252 } 185 253 … … 192 260 } 193 261 194 #include <netinet/in.h>195 #include <arpa/inet.h>196 #include <sys/types.h>197 #include <sys/socket.h>198 262 199 263 void emu_profile_argument_debug(struct emu_profile_argument *argument, int indent) … … 225 289 break; 226 290 227 case render_ ref:291 case render_ptr: 228 292 { 229 293 struct emu_profile_argument *argit = argument; 230 while (argit->render == render_ ref)294 while (argit->render == render_ptr) 231 295 { 232 argit = argit->value.t ref.ref;296 argit = argit->value.tptr.ptr; 233 297 } 234 298 235 299 if (argit->render == render_struct) 236 printf("%s struct %s %s = 0x%08x => \n", indents(indent), argument->argtype, argument->argname, argument->value.t ref.addr);300 printf("%s struct %s %s = 0x%08x => \n", indents(indent), argument->argtype, argument->argname, argument->value.tptr.addr); 237 301 else 238 printf("%s %s %s = 0x%08x => \n", indents(indent), argument->argtype, argument->argname, argument->value.t ref.addr);239 240 emu_profile_argument_debug(argument->value.t ref.ref, indent+1);302 printf("%s %s %s = 0x%08x => \n", indents(indent), argument->argtype, argument->argname, argument->value.tptr.addr); 303 304 emu_profile_argument_debug(argument->value.tptr.ptr, indent+1); 241 305 } 242 306 break; … … 248 312 case render_port: 249 313 printf("%s %s %s = %i (port=%i);\n", indents(indent), argument->argtype, argument->argname, argument->value.tint, ntohs((uint16_t)argument->value.tint)); 314 break; 315 316 case render_none: 317 printf("%s none;\n", indents(indent)); 250 318 break; 251 319 } … … 276 344 printf(");\n"); 277 345 } 278 /* 279 int main() 280 { 281 struct emu_profile *profile = emu_profile_new(); 282 283 emu_profile_function_add(profile, "CreateProcess"); 284 285 emu_profile_argument_add_ref(profile, "pszImageName", 0x7411); 286 emu_profile_argument_add_char(profile, "foo","foo"); 287 288 emu_profile_argument_add_ref(profile, "pszCmdLine", 0x52f894); 289 emu_profile_argument_add_char(profile,"","tftp.exe -i 192.168.0.1 get direct.exe"); 290 291 emu_profile_argument_add_ref(profile, "psaProcess", 0); 292 emu_profile_argument_add_int(profile, "", 0); 293 294 emu_profile_argument_add_ref(profile, "psaThread",0); 295 296 emu_profile_argument_add_int(profile, "fInheritHandles",1); 297 emu_profile_argument_add_int(profile, "fdwCreate",40); 298 299 emu_profile_argument_add_ref(profile, "pvEnvironment",0); 300 emu_profile_argument_add_int(profile, "",""); 301 302 emu_profile_argument_add_ref(profile, "pszCurDir",0); 303 emu_profile_argument_add_int(profile, "",""); 304 305 emu_profile_argument_add_ref(profile, "psiStartInfo",0x52f74c); 306 emu_profile_argument_start(profile, "STARTUPINFO"); 307 emu_profile_argument_add_int(profile, "cb",0); 308 emu_profile_argument_add_int(profile, "lpReserved",0x00000000); 309 emu_profile_argument_add_int(profile, "lpDesktop",0x00000000); 310 emu_profile_argument_add_int(profile, "lpTitle",0x00000000); 311 emu_profile_argument_add_int(profile, "dwX",0); 312 emu_profile_argument_add_int(profile, "dwY",0); 313 emu_profile_argument_add_int(profile, "dwXSize",0); 314 emu_profile_argument_add_int(profile, "dwYSize",0); 315 emu_profile_argument_add_int(profile, "dwXCountChars",0); 316 emu_profile_argument_add_int(profile, "dwYCountChars",0); 317 emu_profile_argument_add_int(profile, "dwFillAttribute",0); 318 emu_profile_argument_add_int(profile, "dwFlags",0); 319 emu_profile_argument_add_int(profile, "wShowWindow",0); 320 emu_profile_argument_add_int(profile, "cbReserved2",0); 321 emu_profile_argument_add_int(profile, "lpReserved2",0x080); 322 emu_profile_argument_add_int(profile, "hStdInput",0); 323 emu_profile_argument_add_int(profile, "hStdOutput",0); 324 emu_profile_argument_add_int(profile, "hStdError",68); 325 emu_profile_argument_end(profile); 326 327 328 emu_profile_argument_add_ref(profile, "pProcInfo",0x52f74c); 329 emu_profile_argument_start(profile, "PROCESS_INFORMATION"); 330 emu_profile_argument_add_int(profile, "hProcess",4711); 331 emu_profile_argument_add_int(profile, "hThread",4712); 332 emu_profile_argument_add_int(profile, "dwProcessId",4713); 333 emu_profile_argument_add_int(profile, "dwThreadId",4714); 334 emu_profile_argument_end(profile); 335 336 337 338 339 340 emu_profile_debug(profile); 341 342 return 0; 343 } 344 */ 345 346 346 347 libemu/trunk/src/environment/linux/emu_env_linux.c
r1442 r1507 56 56 57 57 58 void emu_ linux_free(struct emu_env_linux *eel)58 void emu_env_linux_free(struct emu_env_linux *eel) 59 59 { 60 60 emu_hashtable_free(eel->syscall_hooks_by_name); libemu/trunk/src/environment/win32/emu_env_w32.c
r1505 r1507 210 210 } 211 211 free(env->loaded_dlls); 212 emu_profile_free(env->profile); 212 213 free(env); 214 213 215 } 214 216 libemu/trunk/src/environment/win32/env_w32_dll_export_kernel32_hooks.c
r1505 r1507 111 111 uint32_t filename; 112 112 POP_DWORD(c, &filename); 113 emu_profile_argument_add_ ref(env->profile, "LPCTSTR", "lpFileName", filename);114 emu_profile_argument_add_ string(env->profile, "", "", "");113 emu_profile_argument_add_ptr(env->profile, "LPCTSTR", "lpFileName", filename); 114 emu_profile_argument_add_none(env->profile); 115 115 116 116 … … 125 125 uint32_t securityattr; 126 126 POP_DWORD(c, &securityattr); 127 emu_profile_argument_add_ ref(env->profile, "LPSECURITY_ATTRIBUTES", "lpSecurityAttributes", securityattr);128 emu_profile_argument_add_ int(env->profile, "", "", 0);127 emu_profile_argument_add_ptr(env->profile, "LPSECURITY_ATTRIBUTES", "lpSecurityAttributes", securityattr); 128 emu_profile_argument_add_none(env->profile); 129 129 130 130 uint32_t createdisp; … … 174 174 uint32_t p_imagename; 175 175 POP_DWORD(c, &p_imagename); 176 emu_profile_argument_add_ ref(env->profile, "LPCWSTR", "pszImageName", p_imagename);177 emu_profile_argument_add_ string(env->profile, "", "", "");176 emu_profile_argument_add_ptr(env->profile, "LPCWSTR", "pszImageName", p_imagename); 177 emu_profile_argument_add_none(env->profile); 178 178 179 179 uint32_t p_cmdline; 180 180 POP_DWORD(c, &p_cmdline); 181 emu_profile_argument_add_ ref(env->profile, "LPCWSTR", "pszCmdLine", p_cmdline);181 emu_profile_argument_add_ptr(env->profile, "LPCWSTR", "pszCmdLine", p_cmdline); 182 182 183 183 struct emu_string *command = emu_string_new(); … … 189 189 uint32_t p_process; 190 190 POP_DWORD(c, &p_process); 191 emu_profile_argument_add_ ref(env->profile, "LPSECURITY_ATTRIBUTES", "psaProcess", p_process);192 emu_profile_argument_add_ string(env->profile, "", "", "");191 emu_profile_argument_add_ptr(env->profile, "LPSECURITY_ATTRIBUTES", "psaProcess", p_process); 192 emu_profile_argument_add_none(env->profile); 193 193 194 194 195 195 uint32_t p_thread; 196 196 POP_DWORD(c, &p_thread); 197 emu_profile_argument_add_ ref(env->profile, "LPSECURITY_ATTRIBUTES", "psaThread", p_thread);198 emu_profile_argument_add_ string(env->profile, "", "", "");197 emu_profile_argument_add_ptr(env->profile, "LPSECURITY_ATTRIBUTES", "psaThread", p_thread); 198 emu_profile_argument_add_none(env->profile); 199 199 200 200 … … 210 210 uint32_t environment; 211 211 POP_DWORD(c, &environment); 212 emu_profile_argument_add_ ref(env->profile, "LPVOID", "pvEnvironment", environment);213 emu_profile_argument_add_ string(env->profile, "", "", "");212 emu_profile_argument_add_ptr(env->profile, "LPVOID", "pvEnvironment", environment); 213 emu_profile_argument_add_none(env->profile); 214 214 215 215 216 216 uint32_t cwd; 217 217 POP_DWORD(c, &cwd); 218 emu_profile_argument_add_ ref(env->profile, "LPWSTR", "pszCurDir", cwd);219 emu_profile_argument_add_ string(env->profile, "", "", "");218 emu_profile_argument_add_ptr(env->profile, "LPWSTR", "pszCurDir", cwd); 219 emu_profile_argument_add_none(env->profile); 220 220 221 221 222 222 uint32_t p_startinfo; 223 223 POP_DWORD(c, &p_startinfo); 224 emu_profile_argument_add_ ref(env->profile, "LPSTARTUPINFOW", "psiStartInfo", p_startinfo);224 emu_profile_argument_add_ptr(env->profile, "LPSTARTUPINFOW", "psiStartInfo", p_startinfo); 225 225 226 226 STARTUPINFO *si = malloc(sizeof(STARTUPINFO)); 227 227 emu_memory_read_block(m, p_startinfo, si, sizeof(STARTUPINFO)); 228 228 229 emu_profile_argument_st art(env->profile, "", "");229 emu_profile_argument_struct_start(env->profile, "", ""); 230 230 emu_profile_argument_add_int(env->profile, "DWORD", "cb" , si->cb); 231 231 emu_profile_argument_add_int(env->profile, "LPTSTR", "lpReserved" , (unsigned int)si->lpReserved); … … 246 246 emu_profile_argument_add_int(env->profile, "HANDLE", "hStdOutput" , si->hStdOutput); 247 247 emu_profile_argument_add_int(env->profile, "HANDLE", "hStdError" , si->hStdError); 248 emu_profile_argument_ end(env->profile);248 emu_profile_argument_struct_end(env->profile); 249 249 250 250 251 251 uint32_t p_procinfo; 252 252 POP_DWORD(c, &p_procinfo); 253 emu_profile_argument_add_ ref(env->profile, "PROCESS_INFORMATION", "pProcInfo",0x52f74c);253 emu_profile_argument_add_ptr(env->profile, "PROCESS_INFORMATION", "pProcInfo",0x52f74c); 254 254 255 255 PROCESS_INFORMATION *pi = malloc(sizeof(PROCESS_INFORMATION)); 256 256 emu_memory_read_block(m, p_procinfo, pi, sizeof(PROCESS_INFORMATION)); 257 257 258 emu_profile_argument_st art(env->profile, "", "");258 emu_profile_argument_struct_start(env->profile, "", ""); 259 259 emu_profile_argument_add_int(env->profile, "DWORD", "hProcess" ,pi->dwProcessId); 260 260 emu_profile_argument_add_int(env->profile, "DWORD", "hThread" ,pi->dwThreadId); 261 261 emu_profile_argument_add_int(env->profile, "HANDLE", "dwProcessId" ,pi->hProcess); 262 262 emu_profile_argument_add_int(env->profile, "HANDLE", "dwThreadId" ,pi->hThread); 263 emu_profile_argument_ end(env->profile);263 emu_profile_argument_struct_end(env->profile); 264 264 265 265 … … 329 329 uint32_t filename; 330 330 POP_DWORD(c, &filename); 331 emu_profile_argument_add_ ref(env->profile, "LPCTSTR", "lpFileName", filename);332 emu_profile_argument_add_ string(env->profile, "", "", "");331 emu_profile_argument_add_ptr(env->profile, "LPCTSTR", "lpFileName", filename); 332 emu_profile_argument_add_none(env->profile); 333 333 334 334 emu_cpu_eip_set(c, eip_save); … … 511 511 uint32_t p_procname; 512 512 POP_DWORD(c, &p_procname); 513 emu_profile_argument_add_ ref(env->profile, "LPCSTR", "lpProcName", p_procname);513 emu_profile_argument_add_ptr(env->profile, "LPCSTR", "lpProcName", p_procname); 514 514 515 515 … … 573 573 uint32_t p_buffer; 574 574 POP_DWORD(c, &p_buffer); 575 emu_profile_argument_add_ ref(env->profile, "LPTSTR", "lpBuffer", p_buffer);576 emu_profile_argument_add_ string(env->profile, "", "", "");575 emu_profile_argument_add_ptr(env->profile, "LPTSTR", "lpBuffer", p_buffer); 576 emu_profile_argument_add_none(env->profile); 577 577 578 578 uint32_t size; … … 710 710 uint32_t dllname_ptr;// = emu_cpu_reg32_get(c, esp); 711 711 POP_DWORD(c, &dllname_ptr); 712 emu_profile_argument_add_ ref(env->profile, "LPCTSTR", "lpFileName", dllname_ptr);712 emu_profile_argument_add_ptr(env->profile, "LPCTSTR", "lpFileName", dllname_ptr); 713 713 714 714 … … 921 921 uint32_t p_cmdline; 922 922 POP_DWORD(c, &p_cmdline); 923 emu_profile_argument_add_ ref(env->profile, "LPCSTR", "lpCmdLine", p_cmdline);923 emu_profile_argument_add_ptr(env->profile, "LPCSTR", "lpCmdLine", p_cmdline); 924 924 925 925 struct emu_string *cmdstr = emu_string_new(); libemu/trunk/src/environment/win32/env_w32_dll_export_urlmon_hooks.c
r1505 r1507 71 71 uint32_t p_caller; 72 72 POP_DWORD(c, &p_caller); 73 emu_profile_argument_add_ ref(env->profile, "LPUNKNOWN", "pCaller", p_caller);74 emu_profile_argument_add_ string(env->profile, "", "", "");73 emu_profile_argument_add_ptr(env->profile, "LPUNKNOWN", "pCaller", p_caller); 74 emu_profile_argument_add_none(env->profile); 75 75 76 76 uint32_t p_url; 77 77 POP_DWORD(c, &p_url); 78 emu_profile_argument_add_ ref(env->profile, "LPCTSTR", "szURL", p_url);78 emu_profile_argument_add_ptr(env->profile, "LPCTSTR", "szURL", p_url); 79 79 80 80 struct emu_string *url = emu_string_new(); … … 85 85 uint32_t p_filename; 86 86 POP_DWORD(c, &p_filename); 87 emu_profile_argument_add_ ref(env->profile, "LPCTSTR", "szFileName", p_filename);87 emu_profile_argument_add_ptr(env->profile, "LPCTSTR", "szFileName", p_filename); 88 88 89 89 struct emu_string *filename = emu_string_new(); libemu/trunk/src/environment/win32/env_w32_dll_export_ws2_32_hooks.c
r1505 r1507 76 76 uint32_t addr; 77 77 POP_DWORD(c, &addr); 78 emu_profile_argument_add_ ref(env->profile, "sockaddr *", "addr", addr);79 emu_profile_argument_st art(env->profile, "", "");80 emu_profile_argument_ end(env->profile);78 emu_profile_argument_add_ptr(env->profile, "sockaddr *", "addr", addr); 79 emu_profile_argument_struct_start(env->profile, "", ""); 80 emu_profile_argument_struct_end(env->profile); 81 81 82 82 uint32_t addrlen; 83 83 POP_DWORD(c, &addrlen); 84 emu_profile_argument_add_ ref(env->profile, "int", "addrlen", addrlen);85 emu_profile_argument_add_ int(env->profile, "", "", 0);84 emu_profile_argument_add_ptr(env->profile, "int", "addrlen", addrlen); 85 emu_profile_argument_add_none(env->profile); 86 86 87 87 printf("accept(s=%i, addr=%x, addrlen=%i);\n", s, addr, addrlen); … … 121 121 uint32_t s; 122 122 POP_DWORD(c, &s); 123 emu_profile_argument_add_int(env->profile, "SOCKET", "s", s); 123 124 124 125 … … 128 129 129 130 130 /*131 struct sockaddr_in {132 short sin_family; // e.g. AF_INET133 unsigned short sin_port; // e.g. htons(3490)134 struct in_addr sin_addr; // see struct in_addr, below135 char sin_zero[8]; // zero this if you want to136 };137 138 struct in_addr {139 unsigned long s_addr; // load with inet_aton()140 };141 */142 131 struct sockaddr sa; 143 132 … … 146 135 { 147 136 struct sockaddr_in *si = (struct sockaddr_in *)&sa; 148 emu_profile_argument_add_ ref(env->profile, "sockaddr_in *", "name", name);149 emu_profile_argument_st art(env->profile, "", "");137 emu_profile_argument_add_ptr(env->profile, "sockaddr_in *", "name", name); 138 emu_profile_argument_struct_start(env->profile, "", ""); 150 139 emu_profile_argument_add_int(env->profile, "short", "sin_family", si->sin_family); 151 140 emu_profile_argument_add_port(env->profile, "unsigned short", "sin_port", si->sin_port); 152 emu_profile_argument_st art(env->profile, "in_addr", "sin_addr");141 emu_profile_argument_struct_start(env->profile, "in_addr", "sin_addr"); 153 142 emu_profile_argument_add_ip(env->profile, "unsigned long", "s_addr", si->sin_addr.s_addr); 154 emu_profile_argument_ end(env->profile);143 emu_profile_argument_struct_end(env->profile); 155 144 emu_profile_argument_add_string(env->profile, "char", "sin_zero", " "); 156 emu_profile_argument_ end(env->profile);145 emu_profile_argument_struct_end(env->profile); 157 146 158 147 }else 159 148 { 160 emu_profile_argument_st art(env->profile, "sockaddr *", "name");161 emu_profile_argument_ end(env->profile);149 emu_profile_argument_struct_start(env->profile, "sockaddr *", "name"); 150 emu_profile_argument_struct_end(env->profile); 162 151 } 163 152 … … 245 234 { 246 235 struct sockaddr_in *si = (struct sockaddr_in *)&sa; 247 emu_profile_argument_add_ ref(env->profile, "sockaddr_in *", "name", name);248 emu_profile_argument_st art(env->profile, "", "");236 emu_profile_argument_add_ptr(env->profile, "sockaddr_in *", "name", name); 237 emu_profile_argument_struct_start(env->profile, "", ""); 249 238 emu_profile_argument_add_int(env->profile, "short", "sin_family", si->sin_family); 250 239 emu_profile_argument_add_port(env->profile, "unsigned short", "sin_port", si->sin_port); 251 emu_profile_argument_st art(env->profile, "in_addr", "sin_addr");240 emu_profile_argument_struct_start(env->profile, "in_addr", "sin_addr"); 252 241 emu_profile_argument_add_ip(env->profile, "unsigned long", "s_addr", si->sin_addr.s_addr); 253 emu_profile_argument_ end(env->profile);242 emu_profile_argument_struct_end(env->profile); 254 243 emu_profile_argument_add_string(env->profile, "char", "sin_zero", " "); 255 emu_profile_argument_ end(env->profile);244 emu_profile_argument_struct_end(env->profile); 256 245 257 246 }else 258 247 { 259 emu_profile_argument_st art(env->profile, "sockaddr *", "name");260 emu_profile_argument_ end(env->profile);248 emu_profile_argument_struct_start(env->profile, "sockaddr *", "name"); 249 emu_profile_argument_struct_end(env->profile); 261 250 } 262 251 libemu/trunk/testsuite/sctest.c
r1504 r1507 1881 1881 1882 1882 emu_env_w32_free(env); 1883 emu_env_linux_free(lenv); 1883 1884 emu_free(e); 1884 1885 return 0;
