Changeset 1507

Show
Ignore:
Timestamp:
01/13/08 22:39:58 (8 months ago)
Author:
common
Message:

libemu

  • emu_profile rename *_ref to *_ptr
  • rename emu_profile_argument_{start,end} to emu_profile_argument_struct_{start,end}
  • introduce render_none, usefull for refs where the actual value is uninteresting
  • free the mallocs, emu_profile properly cleans up now
  • sctest runs leakfree
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libemu/trunk/include/emu/emu_hashtable.h

    r1317 r1507  
    6161 
    6262struct emu_hashtable_bucket_item *emu_hashtable_bucket_item_new(void *key, void *value); 
    63  
     63void emu_hashtable_bucket_item_free(struct emu_hashtable_bucket_item *ehbi); 
    6464 
    6565struct emu_hashtable_bucket 
  • libemu/trunk/include/emu/environment/emu_profile.h

    r1505 r1507  
    3636enum emu_profile_argument_render 
    3737{ 
    38         render_ref, 
     38        render_none, 
     39        render_ptr, 
    3940        render_int, 
    4041        render_struct, 
     
    6566                struct 
    6667                { 
    67                         struct emu_profile_argument *ref
     68                        struct emu_profile_argument *ptr
    6869                        uint32_t addr; 
    69                 }tref
     70                }tptr
    7071        } value; 
    7172 
     
    111112void emu_profile_debug(struct emu_profile *profile); 
    112113void emu_profile_function_debug(struct emu_profile_function *function); 
     114 
     115void emu_profile_argument_add_none(struct emu_profile *profile); 
    113116void emu_profile_argument_add_int(struct emu_profile *profile, char *argtype, char *argname, int value); 
    114117void 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); 
     118void emu_profile_argument_add_ptr(struct emu_profile *profile,        char *argtype,  char *argname, uint32_t value); 
    116119void emu_profile_argument_add_ip(struct emu_profile *profile, char *argtype,  char *argname, uint32_t value); 
    117120void emu_profile_argument_add_port(struct emu_profile *profile, char *argtype,  char *argname, uint32_t value); 
    118121 
    119122void emu_profile_function_add(struct emu_profile *profile, char *fnname); 
    120 void emu_profile_argument_start(struct emu_profile* profile, const char* structtype, const char* structname); 
    121 void emu_profile_argument_end(struct emu_profile *profile); 
     123void emu_profile_argument_struct_start(struct emu_profile* profile, const char* structtype, const char* structname); 
     124void emu_profile_argument_struct_end(struct emu_profile *profile); 
    122125 
    123126 
  • libemu/trunk/include/emu/environment/linux/emu_env_linux.h

    r1442 r1507  
    4848 
    4949struct emu_env_linux *emu_env_linux_new(struct emu *e); 
    50 void emu_linux_free(struct emu_env_linux *eel); 
     50void emu_env_linux_free(struct emu_env_linux *eel); 
    5151 
    5252struct emu_env_linux_syscall *emu_env_linux_syscall_check(struct emu_env_linux *env); 
  • libemu/trunk/src/emu_hashtable.c

    r1317 r1507  
    7070                if ((ehb = eh->buckets[i]) != NULL) 
    7171                { 
    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) 
    7374                        { 
    7475                                if (eh->key_destructor != NULL) 
     
    8081                                        eh->value_destructor(ehbi->item.value); 
    8182                                } 
     83                                emu_hashtable_bucket_item_free(ehbi); 
    8284                        } 
    8385         
     
    203205        return ehbi; 
    204206} 
     207 
     208 
     209void emu_hashtable_bucket_item_free(struct emu_hashtable_bucket_item *ehbi) 
     210{ 
     211        free(ehbi); 
     212} 
  • libemu/trunk/src/emu_stack.c

    r1505 r1507  
    6464                return NULL; 
    6565 
     66        struct emu_stack_item *item = es->front; 
    6667        void *data = es->front->data; 
    6768        es->front = es->front->next; 
     69        free(item); 
    6870        return data; 
    6971} 
  • libemu/trunk/src/environment/emu_profile.c

    r1505 r1507  
    2929#include <stdlib.h> 
    3030#include <stdio.h> 
     31#include <netinet/in.h> 
     32#include <arpa/inet.h> 
     33#include <sys/types.h> 
     34#include <sys/socket.h> 
     35 
    3136 
    3237#include "emu/environment/emu_profile.h" 
     
    4954void emu_profile_free(struct emu_profile *profile) 
    5055{ 
    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); 
    5264} 
    5365 
     
    7991        }else 
    8092        { 
    81                 profile->last_ref->value.tref.ref = argument; 
     93                profile->last_ref->value.tptr.ptr = argument; 
    8294                profile->last_ref = NULL; 
    8395        } 
     
    8597 
    8698 
    87 void emu_profile_argument_start(struct emu_profile* profile, const char* structtype, const char* structname) 
     99void emu_profile_argument_struct_start(struct emu_profile* profile, const char* structtype, const char* structname) 
    88100{ 
    89101//      printf("%s %s\n", __PRETTY_FUNCTION__,  structname); 
     
    98110 
    99111 
    100 void emu_profile_argument_end(struct emu_profile *profile) 
     112void emu_profile_argument_struct_end(struct emu_profile *profile) 
    101113{ 
    102114//      printf("%s %s\n", __PRETTY_FUNCTION__); 
     
    105117 
    106118 
     119void 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 
    107125void emu_profile_argument_add_int(struct emu_profile *profile, char *argtype, char *argname, int value) 
    108126{ 
     
    121139} 
    122140 
    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.tref.addr = value; 
     141void 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; 
    127145        emu_profile_argument_add(profile, argument); 
    128146        profile->last_ref = argument; 
     
    157175{ 
    158176 
     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); 
    159188} 
    160189 
     
    167196 
    168197        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        } 
    171203        argument->render = render; 
    172204 
     
    181213void emu_profile_argument_free(struct emu_profile_argument *argument) 
    182214{ 
    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); 
    184252} 
    185253 
     
    192260} 
    193261 
    194 #include <netinet/in.h> 
    195 #include <arpa/inet.h> 
    196 #include <sys/types.h> 
    197 #include <sys/socket.h> 
    198262 
    199263void emu_profile_argument_debug(struct emu_profile_argument *argument, int indent) 
     
    225289                break; 
    226290 
    227         case render_ref
     291        case render_ptr
    228292                { 
    229293                        struct emu_profile_argument *argit = argument; 
    230                         while (argit->render == render_ref
     294                        while (argit->render == render_ptr
    231295                        { 
    232                                 argit = argit->value.tref.ref
     296                                argit = argit->value.tptr.ptr
    233297                        } 
    234298 
    235299                        if (argit->render == render_struct) 
    236                                 printf("%s struct %s %s = 0x%08x => \n", indents(indent), argument->argtype, argument->argname, argument->value.tref.addr); 
     300                                printf("%s struct %s %s = 0x%08x => \n", indents(indent), argument->argtype, argument->argname, argument->value.tptr.addr); 
    237301                        else 
    238                                 printf("%s %s %s = 0x%08x => \n", indents(indent), argument->argtype, argument->argname, argument->value.tref.addr); 
    239  
    240                         emu_profile_argument_debug(argument->value.tref.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); 
    241305                } 
    242306                break; 
     
    248312        case render_port: 
    249313                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)); 
    250318                break; 
    251319        } 
     
    276344        printf(");\n"); 
    277345} 
    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  
    5656 
    5757 
    58 void emu_linux_free(struct emu_env_linux *eel) 
     58void emu_env_linux_free(struct emu_env_linux *eel) 
    5959{ 
    6060        emu_hashtable_free(eel->syscall_hooks_by_name); 
  • libemu/trunk/src/environment/win32/emu_env_w32.c

    r1505 r1507  
    210210        } 
    211211        free(env->loaded_dlls); 
     212        emu_profile_free(env->profile); 
    212213        free(env); 
     214 
    213215} 
    214216 
  • libemu/trunk/src/environment/win32/env_w32_dll_export_kernel32_hooks.c

    r1505 r1507  
    111111        uint32_t filename; 
    112112        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); 
    115115 
    116116 
     
    125125        uint32_t securityattr; 
    126126        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); 
    129129 
    130130    uint32_t createdisp; 
     
    174174        uint32_t p_imagename; 
    175175        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); 
    178178 
    179179        uint32_t p_cmdline; 
    180180        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); 
    182182 
    183183        struct emu_string *command = emu_string_new(); 
     
    189189        uint32_t p_process; 
    190190        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); 
    193193 
    194194 
    195195        uint32_t p_thread; 
    196196        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); 
    199199 
    200200 
     
    210210        uint32_t environment; 
    211211        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); 
    214214 
    215215 
    216216        uint32_t cwd; 
    217217        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); 
    220220 
    221221 
    222222        uint32_t p_startinfo; 
    223223        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); 
    225225 
    226226        STARTUPINFO *si = malloc(sizeof(STARTUPINFO)); 
    227227        emu_memory_read_block(m, p_startinfo, si, sizeof(STARTUPINFO)); 
    228228 
    229         emu_profile_argument_start(env->profile, "", ""); 
     229        emu_profile_argument_struct_start(env->profile, "", ""); 
    230230        emu_profile_argument_add_int(env->profile, "DWORD",  "cb"                               , si->cb);                                                    
    231231        emu_profile_argument_add_int(env->profile, "LPTSTR", "lpReserved"               , (unsigned int)si->lpReserved); 
     
    246246        emu_profile_argument_add_int(env->profile, "HANDLE", "hStdOutput"               , si->hStdOutput);                                            
    247247        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); 
    249249         
    250250 
    251251        uint32_t p_procinfo; 
    252252        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); 
    254254 
    255255        PROCESS_INFORMATION *pi = malloc(sizeof(PROCESS_INFORMATION)); 
    256256        emu_memory_read_block(m, p_procinfo, pi, sizeof(PROCESS_INFORMATION)); 
    257257 
    258         emu_profile_argument_start(env->profile, "", ""); 
     258        emu_profile_argument_struct_start(env->profile, "", ""); 
    259259        emu_profile_argument_add_int(env->profile, "DWORD", "hProcess"          ,pi->dwProcessId); 
    260260        emu_profile_argument_add_int(env->profile, "DWORD", "hThread"                   ,pi->dwThreadId); 
    261261        emu_profile_argument_add_int(env->profile, "HANDLE", "dwProcessId"              ,pi->hProcess); 
    262262        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); 
    264264 
    265265 
     
    329329        uint32_t filename; 
    330330        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); 
    333333 
    334334        emu_cpu_eip_set(c, eip_save); 
     
    511511        uint32_t p_procname; 
    512512        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); 
    514514         
    515515 
     
    573573        uint32_t p_buffer; 
    574574        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); 
    577577 
    578578        uint32_t size; 
     
    710710        uint32_t dllname_ptr;// = emu_cpu_reg32_get(c, esp); 
    711711    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); 
    713713         
    714714 
     
    921921        uint32_t p_cmdline; 
    922922        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); 
    924924 
    925925        struct emu_string *cmdstr = emu_string_new(); 
  • libemu/trunk/src/environment/win32/env_w32_dll_export_urlmon_hooks.c

    r1505 r1507  
    7171        uint32_t p_caller; 
    7272        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); 
    7575 
    7676        uint32_t p_url; 
    7777        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); 
    7979 
    8080    struct emu_string *url = emu_string_new(); 
     
    8585        uint32_t p_filename; 
    8686        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); 
    8888 
    8989        struct emu_string *filename = emu_string_new(); 
  • libemu/trunk/src/environment/win32/env_w32_dll_export_ws2_32_hooks.c

    r1505 r1507  
    7676        uint32_t addr; 
    7777        POP_DWORD(c, &addr); 
    78         emu_profile_argument_add_ref(env->profile, "sockaddr *", "addr", addr); 
    79         emu_profile_argument_start(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); 
    8181 
    8282        uint32_t addrlen; 
    8383        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); 
    8686 
    8787        printf("accept(s=%i, addr=%x, addrlen=%i);\n", s, addr, addrlen); 
     
    121121        uint32_t s; 
    122122        POP_DWORD(c, &s); 
     123        emu_profile_argument_add_int(env->profile, "SOCKET", "s", s); 
    123124 
    124125 
     
    128129         
    129130 
    130 /* 
    131 struct sockaddr_in { 
    132     short            sin_family;   // e.g. AF_INET 
    133     unsigned short   sin_port;     // e.g. htons(3490) 
    134     struct in_addr   sin_addr;     // see struct in_addr, below 
    135     char             sin_zero[8];  // zero this if you want to 
    136 }; 
    137  
    138 struct in_addr { 
    139     unsigned long s_addr;  // load with inet_aton() 
    140 }; 
    141 */ 
    142131        struct sockaddr sa; 
    143132         
     
    146135        { 
    147136                struct sockaddr_in *si = (struct sockaddr_in *)&sa; 
    148                 emu_profile_argument_add_ref(env->profile, "sockaddr_in *", "name", name); 
    149                 emu_profile_argument_start(env->profile, "", ""); 
     137                emu_profile_argument_add_ptr(env->profile, "sockaddr_in *", "name", name); 
     138                emu_profile_argument_struct_start(env->profile, "", ""); 
    150139                emu_profile_argument_add_int(env->profile, "short", "sin_family", si->sin_family); 
    151140                emu_profile_argument_add_port(env->profile, "unsigned short", "sin_port", si->sin_port); 
    152                 emu_profile_argument_start(env->profile, "in_addr", "sin_addr"); 
     141                emu_profile_argument_struct_start(env->profile, "in_addr", "sin_addr"); 
    153142                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); 
    155144                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); 
    157146 
    158147        }else 
    159148        { 
    160                 emu_profile_argument_start(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); 
    162151        } 
    163152 
     
    245234        { 
    246235                struct sockaddr_in *si = (struct sockaddr_in *)&sa; 
    247                 emu_profile_argument_add_ref(env->profile, "sockaddr_in *", "name", name); 
    248                 emu_profile_argument_start(env->profile, "", ""); 
     236                emu_profile_argument_add_ptr(env->profile, "sockaddr_in *", "name", name); 
     237                emu_profile_argument_struct_start(env->profile, "", ""); 
    249238                emu_profile_argument_add_int(env->profile, "short", "sin_family", si->sin_family); 
    250239                emu_profile_argument_add_port(env->profile, "unsigned short", "sin_port", si->sin_port); 
    251                 emu_profile_argument_start(env->profile, "in_addr", "sin_addr"); 
     240                emu_profile_argument_struct_start(env->profile, "in_addr", "sin_addr"); 
    252241                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); 
    254243                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); 
    256245 
    257246        }else 
    258247        { 
    259                 emu_profile_argument_start(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); 
    261250        } 
    262251 
  • libemu/trunk/testsuite/sctest.c

    r1504 r1507  
    18811881         
    18821882        emu_env_w32_free(env); 
     1883        emu_env_linux_free(lenv); 
    18831884        emu_free(e); 
    18841885        return 0;