programs/winedbg/winedbg.c
/******************************************************************
 *		dbg_init
 *
 * Initializes the dbghelp library, and also sets the application directory
 * as a place holder for symbol searches.
 */
dbg_init
Initializes the dbghelp library, and also sets the application directory
as a place holder for symbol searches.
dbg_init Initializes the dbghelp library and also sets the application directory as a place holder for symbol searches .
BOOL dbg_init(HANDLE hProc, const WCHAR* in, BOOL invade)
{
    BOOL        ret;
    ret = SymInitialize(hProc, NULL, invade);
    if (ret && in)
    {
        const WCHAR*    last;
        for (last = in + lstrlenW(in) - 1; last >= in; last--)
        {
            if (*last == '/' || *last == '\\')
            {
                WCHAR*  tmp;
                tmp = HeapAlloc(GetProcessHeap(), 0, (1024 + 1 + (last - in) + 1) * sizeof(WCHAR));
                if (tmp && SymGetSearchPathW(hProc, tmp, 1024))
                {
                    WCHAR*      x = tmp + lstrlenW(tmp);
                    *x++ = ';';
                    memcpy(x, in, (last - in) * sizeof(WCHAR));
                    x[last - in] = '\0';
                    ret = SymSetSearchPathW(hProc, tmp);
                }
                else ret = FALSE;
                HeapFree(GetProcessHeap(), 0, tmp);
                break;
            }
        }
    }
    return ret;
}
BOOL dbg_init ( HANDLE hProc , const WCHAR * in , BOOL invade ) { BOOL ret ; ret = SymInitialize ( hProc , NULL , invade ) ; if ( ret && in ) { const WCHAR * last ; for ( last = in + lstrlenW ( in ) - 1 ; last >= in ; last -- ) { if ( * last == ' ' || * last == ' \\ ' ) { WCHAR * tmp ; tmp = HeapAlloc ( GetProcessHeap ( ) , 0 , ( 1024 + 1 + ( last - in ) + 1 ) * sizeof ( WCHAR ) ) ; if ( tmp && SymGetSearchPathW ( hProc , tmp , 1024 ) ) { WCHAR * x = tmp + lstrlenW ( tmp ) ; * x ++ = ' ' ; memcpy ( x , in , ( last - in ) * sizeof ( WCHAR ) ) ; x [ last - in ] = ' \0 ' ; ret = SymSetSearchPathW ( hProc , tmp ) ; } else ret = FALSE ; HeapFree ( GetProcessHeap ( ) , 0 , tmp ) ; break ; } } } return ret ; }
dbg_init
 Initializes the dbghelp library, and also sets the application directory
 as a place holder for symbol searches.
dbg_init Initializes the dbghelp library and also sets the application directory as a place holder for symbol searches .