Exemple #1
0
static void
registration_success(char *editor_name, char *which, char *path)
{
    W32_CHAR *msg;
    W32_CHAR *arg;
    char status[NFILEN + 256];
    int len;

    len = sprintf(status,
		  "%s OLE Automation successfully %s.",
		  editor_name,
		  which);
    if (path) {
	/* Registered -- warn user about registering temp copy of editor. */

	sprintf(status + len,
		"\r\rNote:  registered path is %s .\r\r"
		"If this path is temporary or otherwise undesirable, install the "
		"editor in its proper destination directory and re-register.",
		path);
    }
    msg = w32_charstring(status);
    arg = w32_charstring(editor_name);
    MessageBox(NULL, msg, arg, MB_ICONINFORMATION | MB_OK);
    free(msg);
    free(arg);
}
Exemple #2
0
static HANDLE
exec_shell(char *cmd, HANDLE *handles, int hide_child)
{
    W32_CHAR             *w32_cmdstr = 0;
    char                 *cmdstr;
    int                  freestr;
    PROCESS_INFORMATION  pi;
    STARTUPINFO          si;

    proc_handle = BAD_PROC_HANDLE;  /* in case of failure */
    TRACE((T_CALLED "exec_shell %s\n", cmd));
    if ((cmdstr = mk_shell_cmd_str(cmd, &freestr, TRUE)) == NULL)
    {
        /* heap exhausted! */

        no_memory("exec_shell");

        /* Give user a chance to read message--more will surely follow. */
        Sleep(3000);
    } else if ((w32_cmdstr = w32_charstring(cmdstr)) == 0) {
        no_memory("exec_shell");
    } else {

        memset(&si, 0, sizeof(si));
        si.cb          = sizeof(si);
        si.dwFlags     = STARTF_USESTDHANDLES;
        si.hStdInput   = handles[0];
        si.hStdOutput  = handles[1];
        si.hStdError   = handles[2];
#if DISP_NTWIN
        if (hide_child)
        {
            si.dwFlags     |= STARTF_USESHOWWINDOW;
            si.wShowWindow  = SW_HIDE;
        }
#endif
        TRACE(("CreateProcess %s (pipe)\n", cmdstr));
        if (CreateProcess(NULL,
                          w32_cmdstr,
                          NULL,
                          NULL,
                          TRUE,       /* Inherit handles */
                          0,
                          NULL,
                          NULL,
                          &si,
                          &pi))
        {
            /* Success */

            w32_close_handle(pi.hThread);
            proc_handle = pi.hProcess;
            TRACE(("...created proc_handle %#x\n", proc_handle));
        }
    }
    FreeIfNeeded(cmdstr);
    FreeIfNeeded(w32_cmdstr);
    returnPtr(proc_handle);
}
Exemple #3
0
static long
delete_key(HKEY key, const char *value)
{
    long rc = ERROR_NOT_ENOUGH_MEMORY;
    W32_CHAR *actual = w32_charstring(value);
    if (actual != 0) {
	rc = RegDeleteKey(key, actual);
	free(actual);
    }
    return rc;
}
Exemple #4
0
static long
create_key(HKEY key, const char *value, HKEY * result)
{
    long rc = ERROR_NOT_ENOUGH_MEMORY;
    W32_CHAR *actual = w32_charstring(value);
    if (actual != 0) {
	rc = RegCreateKeyEx(key,
			    actual,
			    0,
			    NULL,
			    0,
			    KEY_ALL_ACCESS,
			    NULL,
			    result,
			    NULL);
	free(actual);
    }
    return rc;
}
Exemple #5
0
static void
scflush(void)
{
    if (bufpos) {
	COORD coordCursor;
	DWORD written;
#ifdef UNICODE
	W32_CHAR *actual;
	char save_buf;
#endif

	coordCursor.X = (SHORT) ccol;
	coordCursor.Y = (SHORT) crow;
	TRACE2(("scflush %04x [%d,%d]%.*s\n",
		currentAttribute, crow, ccol, bufpos, linebuf));
#ifdef UNICODE
	save_buf = linebuf[bufpos];
	linebuf[bufpos] = 0;
	if ((actual = w32_charstring(linebuf)) != 0) {
	    WriteConsoleOutputCharacter(
					   hConsoleOutput, actual, bufpos,
					   coordCursor, &written
		);
	    free(actual);
	}
	linebuf[bufpos] = save_buf;
#else
	WriteConsoleOutputCharacter(
				       hConsoleOutput, linebuf, bufpos,
				       coordCursor, &written
	    );
#endif
	FillConsoleOutputAttribute(
				      hConsoleOutput, currentAttribute,
				      bufpos, coordCursor, &written
	    );
	ccol += bufpos;
	bufpos = 0;
    }
}