Example #1
0
USHORT parse_days_times(TCHAR FAR *  psz, UCHAR FAR *  bmap)
{

    WEEKLIST	  days;
    DAY 	  times;
    TCHAR    FAR * tok;
    TCHAR    FAR * timetok;
    USHORT	  err;
    USHORT	  max_len;
#if DBG
    int 	  i,j;
    UCHAR    FAR * weekptr;
#endif

    /* zap it all */
    memsetf( (VOID FAR *) bmap, 0, sizeof(WEEK));

    /* get our tables of messages */

    GetMessageList(7, LocalizedDays, &max_len);
    GetMessageList(7, LocalizedDaysAbbrev, &max_len);

#if DBG
    WriteToCon(TEXT("parse_days_times: parsing: %Fs\r\n"),(TCHAR FAR *) psz);
#endif

    /* for each day-time section... */
    while (  (tok = get_token(&psz, TEXT(";"))) != NULL) {

	/* parse up the days */
	if (err = parse_days(tok, days, &timetok))
	    return err;

	/* and the times */
	if (err = parse_times(timetok, &times ))
	    return err;

	/* then "or" them into our week bitmap */
	map_days_times( days, &times, bmap );

    }

#if DBG
    weekptr = bmap;
    for (i = 0; i < 7; ++i) {
	WriteToCon(TEXT("%-2.2s "),LocalizedDaysAbbrev[i].msg_text);
	for (j = 2; j >= 0; --j)
	    WriteToCon(TEXT("%hx "),(USHORT)*(weekptr++));
	WriteToCon(TEXT("\r\n"));
    }
#endif

    return 0;
}
Example #2
0
/*
 * Hongly code, stolen from NIF
 */
CHAR * NEAR findstatus(struct PRINTDEST FAR * dest)
{
    static USHORT   allocated = FALSE;
    USHORT	    len;			/* message format size */

    if (!allocated)	/* retrieve messages from msg file */
    {
	GetMessageList(NUM_DFS_MSGS, DFSMsgList, &len);
	allocated = TRUE;
    }

#ifdef NEEDED_OR_NOT
    if (dest->prdest_jobid == 0 )
	dest->prdest_username[0] = '\0';
#endif

    if ((dest->prdest_status & PRDEST_STATUS_MASK) == PRDEST_PAUSED)
	return DFSMsgList[DEV_MSG_DFS_PAUSED].msg_text;
    else if (dest->prdest_jobid == 0)
	return DFSMsgList[DEV_MSG_DFS_IDLE].msg_text;
    else if (dest->prdest_status & PRJOB_DESTNOPAPER)
	return DFSMsgList[PRINT_MSG_OUT_OF_PAPER].msg_text;
    else if (dest->prdest_status & PRJOB_DESTOFFLINE)
	return DFSMsgList[PRINT_MSG_PRINTER_OFFLINE].msg_text;
    else if (dest->prdest_status & PRJOB_ERROR)
	return DFSMsgList[PRINT_MSG_PRINTER_ERROR].msg_text;
    else if (dest->prdest_status & PRJOB_INTERV)
	return DFSMsgList[PRINT_MSG_PRINTER_INTERV].msg_text;
    else
	return DFSMsgList[DEV_MSG_PRINTING].msg_text;
}
Example #3
0
/***
 *  display_one_p_dev()
 *	displays one print device
 *
 *  Args:
 *	printdest_ptr: ptr to a PRINTDEST structure
 *
 *  Returns:
 *	nothing : success
 */
VOID NEAR display_one_p_dev(struct PRINTDEST FAR * printdest_ptr)

{
    CHAR time_str[LUI_FORMAT_DURATION_LEN + 1];
    LONG time;
    static USHORT   allocated = FALSE;
    USHORT	    len;			/* message format size */

    if (!allocated)	/* retrieve messages from msg file */
    {
	GetMessageList(NUM_DOPD_MSGS, DOPDMsgList, &len);
	allocated = TRUE;
    }

    /* get time in seconds */
    time = 60 * ((ULONG) printdest_ptr->prdest_time);

    /* format it */
    LUI_FormatDuration((LONG FAR *) &time,
		time_str,sizeof(time_str));

    printf("%-5.5Fs%-10.10s%-30.30s%-14.14s%-20.20Fs\n",
	    printdest_ptr->prdest_name,
	    DOPDMsgList[DEV_MSG_SPOOLED].msg_text,
	    findstatus(printdest_ptr),
	time_str,
	    printdest_ptr->prdest_username);
}
Example #4
0
//clears out all contents from the message list
void CBackEndDialog::EmptyMessageList()
{
	CRichEditCtrl* pEdit = GetMessageList();

	pEdit->SetSel(0, -1);
	pEdit->ReplaceSel("");
}
Example #5
0
//adds a message for displaying on the message list
void CBackEndDialog::AddMessageToList(CTaskMessage* pMsg, bool bForceVisible)
{
	CRichEditCtrl* pEdit = GetMessageList();

	//save the original selection
	long nOrigStart, nOrigEnd;
	pEdit->GetSel(nOrigStart, nOrigEnd);

	pEdit->SetSel(-1, -1);

	//save this selection
	long nStartSel, nEndSel;
	pEdit->GetSel(nStartSel, nEndSel);

	//now add in our message text
	pEdit->ReplaceSel(FormatFinalMsg(pMsg));

	//select the text we just added
	pEdit->SetSel(nStartSel, -1);
	
	//change the font for the text we just selected
	CHARFORMAT Format;

	pEdit->GetSelectionCharFormat(Format);
	GetMessageFormat(pMsg, Format);
	pEdit->SetSelectionCharFormat(Format);

	//now clear the selection
	pEdit->SetSel(nOrigStart, nOrigEnd);

	if(bForceVisible)
	{
		//pEdit->LineScroll(10000);
	}
}
Example #6
0
CHAR * NEAR find_chrdev_status(USHORT2ULONG dev_status)
{
    static USHORT   allocated = FALSE;
    USHORT	    len;			/* message format size */

    if (!allocated)	/* retrieve messages from msg file */
    {
	GetMessageList(NUM_FCS_MSGS, FCSMsgList, &len);
	allocated = TRUE;
    }

    if (dev_status & CHARDEV_STAT_ERROR)
	return FCSMsgList[DEV_MSG_ERROR].msg_text;
    else if (dev_status & CHARDEV_STAT_PAUSED)
	return FCSMsgList[DEV_MSG_PAUSED].msg_text;
    else if (dev_status & CHARDEV_STAT_OPENED)
	return FCSMsgList[DEV_MSG_OPENED].msg_text;
    else
	return FCSMsgList[DEV_MSG_IDLE].msg_text;
}
Example #7
0
VOID share_display_share(TCHAR * netname)
{
    USHORT          err;                /* API return status */
    TCHAR FAR *      pBuffer;
    USHORT2ULONG        num_read;           /* num entries read by API */
    USHORT          maxLen;             /* max msg length */
    USHORT          len;                /* message length formater */
    struct share_info_2 FAR * share_entry;
    struct connection_info_1 FAR * conn_entry;
    USHORT2ULONG    i;
    USHORT          more_data = FALSE;

    TCHAR		    txt_UNKNOWN[APE2_GEN_MAX_MSG_LEN];

    LUI_GetMsg(txt_UNKNOWN, APE2_GEN_MAX_MSG_LEN, APE2_GEN_UNKNOWN);

//
// On NT, the redir doesn't have to be running to use the server
//
    start_autostart(txt_SERVICE_FILE_SRV);

    if (err = MNetShareGetInfo(NULL,
                               netname,
                               2,
                               (LPBYTE*)&share_entry))
        ErrorExit(err);

    GetMessageList(NUM_SHARE_MSGS, ShareMsgList, &maxLen);

    len = maxLen + (USHORT) 5;

    share_entry->shi2_type &= ~STYPE_SPECIAL;

    if (share_entry->shi2_type == STYPE_PRINTQ)
        get_print_devices(share_entry->shi2_netname);
    else
        _tcscpy(Buffer, share_entry->shi2_path);

    WriteToCon(fmtPSZ, 0, len,
               PaddedString(len,ShareMsgList[SHARE_MSG_NAME].msg_text,NULL),
               share_entry->shi2_netname);

    WriteToCon(fmtNPSZ, 0, len,
               PaddedString(len,ShareMsgList[SHARE_MSG_PATH].msg_text,NULL),
               Buffer);

    WriteToCon(fmtPSZ, 0, len,
               PaddedString(len,ShareMsgList[SHARE_MSG_REMARK].msg_text,NULL),
               share_entry->shi2_remark);

    if (share_entry->shi2_max_uses == SHI_USES_UNLIMITED)
        WriteToCon(fmtNPSZ, 0, len,
                   PaddedString(len,ShareMsgList[SHARE_MSG_MAX_USERS].msg_text,NULL),
                   ShareMsgList[SHARE_MSG_ULIMIT].msg_text);
    else
        WriteToCon(fmtULONG, 0, len,
                   PaddedString(len,ShareMsgList[SHARE_MSG_MAX_USERS].msg_text,NULL),
                   share_entry->shi2_max_uses);

    NetApiBufferFree((TCHAR FAR *) share_entry);

    if( (err = MNetConnectionEnum(
                      NULL,
                      netname,
                      1,
                      (LPBYTE*)&pBuffer,
                      &num_read)) == ERROR_MORE_DATA)
        more_data = TRUE;
    else if (err)
        ErrorExit( err );


    WriteToCon(TEXT("%-*.*ws"),0,len,
               PaddedString(len,ShareMsgList[SHARE_MSG_USERS].msg_text,NULL));
    for (i = 0, conn_entry = (struct connection_info_1 FAR *) pBuffer;
        i < num_read; i++, conn_entry++)
    {
        if ((i != 0) && ((i % 3) == 0))

            WriteToCon(TEXT("%-*.*ws"),len,len, NULL_STRING);
        WriteToCon(TEXT("%Fws"),
                   PaddedString(21,(conn_entry->coni1_username == NULL)
                                   ? (TCHAR FAR *)txt_UNKNOWN :
                                     conn_entry->coni1_username, NULL));
        if (((i + 1) % 3) == 0)
            PrintNL();
    }
    if ((i == 0) || ((i % 3) != 0))
        PrintNL();

    if (num_read) {
        NetApiBufferFree(pBuffer);
    }

    if( more_data )
        InfoPrint(APE_MoreData);
    else
        InfoSuccess();

}
Example #8
0
/***
 *  share_display_all()
 *      Display info about one share or all shares
 *
 *  Args:
 *      netname - the share to display of NULL for all
 *
 *  Returns:
 *      nothing - success
 *      exit(2) - command failed
 */
VOID share_display_all(VOID)
{
    USHORT          err;                /* API return status */
    TCHAR FAR *      pBuffer;
    USHORT2ULONG    num_read;           /* num entries read by API */
    USHORT          maxLen;             /* max msg length */
    USHORT2ULONG    i;
    struct share_info_2 FAR * share_entry;

//
// On NT, the redir doesn't have to be running to use the server
//

#if !defined(NTENV)
    start_autostart(txt_SERVICE_REDIR);
#endif
    start_autostart(txt_SERVICE_FILE_SRV);
    if (err = MNetShareEnum(
                            NULL,
                            2,
                            (LPBYTE*)&pBuffer,
                            &num_read))
        ErrorExit(err);

    if (num_read == 0)
        EmptyExit();

    NetISort(pBuffer, num_read, sizeof(struct share_info_2), CmpShrInfo2);

    GetMessageList(NUM_SHARE_MSGS, ShareMsgList, &maxLen);

    PrintNL();
    InfoPrint(APE2_SHARE_MSG_HDR);
    PrintLine();

    for (i = 0, share_entry = (struct share_info_2 FAR *) pBuffer;
        i < num_read; i++, share_entry++)
    {
        if (SizeOfHalfWidthString(share_entry->shi2_netname) <= 12)
            WriteToCon(TEXT("%Fws "),PaddedString(12,share_entry->shi2_netname,NULL));
        else
        {
            WriteToCon(TEXT("%Fws"), share_entry->shi2_netname);
            PrintNL();
            WriteToCon(TEXT("%-12.12Fws "), TEXT(""));
        }

        share_entry->shi2_type &= ~STYPE_SPECIAL;

        if (share_entry->shi2_type == STYPE_PRINTQ)
        {
            get_print_devices(share_entry->shi2_netname);
            WriteToCon(TEXT("%ws "),PaddedString(-22, Buffer, NULL));
            WriteToCon(TEXT("%ws "),PaddedString(  8,
                                                 ShareMsgList[SHARE_MSG_SPOOLED].msg_text,
                                                  NULL));
        }
        else
        {
            WriteToCon(TEXT("%Fws "),PaddedString(-31,share_entry->shi2_path,NULL));
        }
        WriteToCon(TEXT("%Fws"),PaddedString(-34,share_entry->shi2_remark,NULL));
        PrintNL();
    }
    InfoSuccess();
    NetApiBufferFree(pBuffer);
}
Example #9
0
//causes the message list to be refreshed
void CBackEndDialog::RedrawMessageList()
{
	GetMessageList()->Invalidate();
}
Example #10
0
BOOL CBackEndDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	//setup the icon for this window
	SetIcon(m_hMainIcon, TRUE);			// Set big icon
	SetIcon(m_hMainIcon, FALSE);		// Set small icon

	//make it so that the OK button is hidden, it will be revealed again once the processing
	//is done
	((CButton*)GetDlgItem(IDOK))->ModifyStyle(WS_VISIBLE, 0);

	//set up the save button to be invisible and have the disk icon
	((CButton*)(GetDlgItem(IDC_BUTTON_SAVE_LOG)))->SetIcon(m_hSaveIcon);
	((CButton*)GetDlgItem(IDC_BUTTON_SAVE_LOG))->ModifyStyle(WS_VISIBLE, 0);

	((CButton*)(GetDlgItem(IDC_BUTTON_MESSAGE_OPTIONS)))->SetIcon(m_hOptionsIcon);

	//setup the progress bar
	CProgressCtrl* pProgress = ((CProgressCtrl*)GetDlgItem(IDC_PROGRESS_TASK));
	pProgress->SetRange(0, 1000);

	//the base registry location
	CString sRegBase = PACKER_REGISTRY_DIRECTORY;

	//set the thread priority to normal
	uint32 nThreadPri = atoi(GetRegistryKey(HKEY_CURRENT_USER, sRegBase + "ThreadPri", "2"));
	((CComboBox*)GetDlgItem(IDC_COMBO_THREAD_PRIORITY))->SetCurSel(nThreadPri);

	//set the message filter to show everything
	uint32 nFilter = atoi(GetRegistryKey(HKEY_CURRENT_USER, sRegBase + "Filter", "5"));
	((CComboBox*)GetDlgItem(IDC_COMBO_MESSAGE_FILTER))->SetCurSel(nFilter);
	OnChangeMessageFilter();

	//create the thread data
	g_ThreadData.m_sFilename		= m_sFilename;
	g_ThreadData.m_pIPackerImpl		= m_pIPackerImpl;
	g_ThreadData.m_pIPackerOutput	= (IPackerOutput*)this;
	g_ThreadData.m_pPropList		= m_pPropList;

	//load the options for the severities
	LoadSevOptionsFromReg();

	//setup the tooltips
	m_ToolTip.Create(this);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_BUTTON_SAVE_LOG), IDS_TOOLTIP_SAVE_LOG);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_COMBO_THREAD_PRIORITY), IDS_TOOLTIP_THREAD_PRIORITY);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_COMBO_MESSAGE_FILTER), IDS_TOOLTIP_MESSAGE_FILTER);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_PROGRESS_TASK), IDS_TOOLTIP_TASK_PROGRESS);
	m_ToolTip.AddWindowTool(GetTaskList(), IDS_TOOLTIP_TASK_LIST);
	m_ToolTip.AddWindowTool(GetMessageList(), IDS_TOOLTIP_MESSAGE_LIST);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_BUTTON_MESSAGE_OPTIONS), IDS_TOOLTIP_MESSAGE_OPTIONS);

	//now we need to launch the background thread which will spawn the packer to do its
	//thing
	DWORD nThreadID;
	m_hThread = CreateThread(NULL, 0, LaunchPackerThreadMain, NULL, 0, &nThreadID); 
	
	//now that the thread is created, we need to ensure that the proper priority is set
	//on it
	OnThreadPriorityChanged();
	
	SetTimer(TIMER_EVENT_ID, 50, NULL);	
	
	return TRUE;  
}