Example #1
0
void nt_init(void) {


#ifdef SECURE_CD
	{
		char temp[512];
		extern char gcurr_drive;
		if(!GetCurrentDirectory(512,temp))
			ExitProcess((DWORD)-1);
		gcurr_drive=temp[0];
	}
#endif SECURE_CD

	init_stdio();
	nt_init_signals();
	nt_term_init();
	init_hb_subst();
	setlocale(LC_ALL,"");
	init_shell_dll();
	init_plister();
	fork_init();
	init_clipboard();
	return;
}
Example #2
0
void nt_init(void) {

    int rc;
    char ptr[MAX_PATH];
    char hdrive[MAX_PATH],hpath[MAX_PATH];
    char *s;
    char *temp=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,MAX_PATH);
    char *pathtemp= NULL;
    gosver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

    if (!GetVersionEx(&gosver)) {
        MessageBox(NULL,"GetVersionEx failed","zsh",MB_ICONHAND);
        ExitProcess(0xFF);
    }
    if (__forked)
        goto skippy;
    if (GetEnvironmentVariable("HOME",ptr,MAX_PATH) != 0) {
        s = ptr;
        while(*s) {
            if (*s == '\\') *s = '/';
            s++;
        }
        SetEnvironmentVariable("HOME",ptr);
        goto skippy;
    }
    if( GetEnvironmentVariable("ZDOTDIR",ptr,MAX_PATH)  != 0)
        goto skippy;

    if(gosver.dwPlatformId == VER_PLATFORM_WIN32_NT) {
        if (gosver.dwMajorVersion <4) {
            GetEnvironmentVariable("HOMEDRIVE",hdrive,MAX_PATH);
            GetEnvironmentVariable("HOMEPATH",hpath,MAX_PATH);
            wsprintf(temp,"%s%s",hdrive,hpath );
        }
        else if (gosver.dwMajorVersion >= 4) {
            GetEnvironmentVariable("USERPROFILE",temp,MAX_PATH);
        }
    }
    else if (gosver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
        rc = GetWindowsDirectory(temp,MAX_PATH);
        if (rc > MAX_PATH) {
            MessageBox(NULL,"This should never happen","zsh",MB_ICONHAND);
            ExitProcess(0xFF);
        }
    }
    else {
        MessageBox(NULL,"Unknown platform","zsh",MB_ICONHAND);
    }
    s = temp;
    while(*s) {
        if(*s == '\\') *s ='/';
        *s++;
    }


    SetEnvironmentVariable("HOME",temp);
skippy:

    rc = GetEnvironmentVariable("PATH",NULL,0);
    pathtemp = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,rc+1);
    rc = GetEnvironmentVariable("PATH",pathtemp,rc+1);

    s = pathtemp;
    while(*s) {
        if(*s == '\\') *s ='/';
        *s++;
    }
    SetEnvironmentVariable("PATH",pathtemp);

    gdwPlatform = gosver.dwPlatformId;

    HeapFree(GetProcessHeap(),0,temp);
    HeapFree(GetProcessHeap(),0,pathtemp);

    init_stdio();
    nt_term_init();
    nt_init_signals();
    init_shell_dll();

}