Esempio n. 1
0
/* ===========================================================================
 * Add, update, freshen, move, or delete zip entries in a zip file.
 * SEE THE FILE "SWITCHES.TXT" FOR MORE INFO. ON PROCESSING
 */
long __stdcall ZipDllExec( ZCL *C )	{
	char           **argVee;
	int              argCee, i = 0, k, Error = 0;
	struct Globals  *pG = GetGlobalPointer( &Error );
	long				   RetVal;

	if ( !pG ) {
		char DllErrMsg[34];

		lstrcpy( DllErrMsg, errors[(Error & 0xFF0000) >> 16] );
		MessageBox( NULL, DllErrMsg, "Msg From ZIP DLL", MB_OK );
		return 0;
	}
Esempio n. 2
0
/* ===========================================================================
 * Compare the two strings ignoring case, and correctly taking into
 * account national language characters.
 * If equal return 0 else != 0.
 */
int namecmp( char *string1, char *string2 ) {
	int             Error;
	struct Globals *pG = GetGlobalPointer( &Error );

	if ( pG ) for (;;) {
		int d = (int)(uch)case_map( *string1 ) - (int)(uch)case_map( *string2 );

		if ( d || *string1 == 0 || *string2 == 0 ) return d;

		string1++;
		string2++;
	}
	return 1;
}
Esempio n. 3
0
bool CALLBACK
PassProc( HWND hDlg, UINT message, UINT wParam, LONG lParam )
{
  int             Error;
  struct Globals  *pG = GetGlobalPointer( &Error );

  if ( !pG )
    return false;
  switch ( message )
  {
    case WM_INITDIALOG:
      /* Set Password character to an asterisk (*) */
      SendDlgItemMessage( hDlg, IDE_PASSWORDEDIT, EM_SETPASSWORDCHAR, (WPARAM) '*',
                          (LPARAM) 0 );

      /* Set the prompt */
      SendDlgItemMessage( hDlg, IDC_PROMPT, WM_SETTEXT, (WPARAM) 0, (LPARAM) pG->lpszPrompt );

      /* Set the default push button to "Cancel." */
      SendMessage( hDlg, DM_SETDEFID, (WPARAM) IDCANCEL, (LPARAM) 0 );

      pG->pwork = true;
      pG->rcode = 0;
      return true;
    case WM_COMMAND:
      /*
                   * Set the default push button to "OK" when the user
                   * enters text.
                   */
      if ( HIWORD( wParam ) == EN_CHANGE && LOWORD( wParam ) == IDE_PASSWORDEDIT )
        SendMessage( hDlg, DM_SETDEFID, (WPARAM) IDOK, (LPARAM) 0 );

      switch ( wParam )
      {
        case IDOK:
          /* Get number of characters. */
          pG->cchPassword = ( WORD ) SendDlgItemMessage( hDlg, IDE_PASSWORDEDIT,
                                                         EM_LINELENGTH, (WPARAM) 0,
                                                         (LPARAM) 0 );

          if ( pG->cchPassword >= PWLEN + 1 )
          {
            MessageBox( (HWND) pG->global_handle, "Too many characters.", "Error", MB_OK );
            EndDialog( hDlg, true );
            pG->rcode = ZEN_PW_ERROR;
            return false;
          }
          else if ( !pG->cchPassword )
          {
            MessageBox( (HWND) pG->global_handle, "No characters entered.", "Error", MB_OK );
            EndDialog( hDlg, true );
            pG->rcode = ZEN_PW_CANCELALL;
            return false;
          }

          /*
                               * Put the number of characters into first word
                               * of buffer.
                               */
          *( (LPWORD) pG->lpszPassword ) = pG->cchPassword;

          /* Get the characters. */
          SendDlgItemMessage( hDlg, IDE_PASSWORDEDIT, EM_GETLINE, (WPARAM) 0, /* line 0 */
                              (LPARAM) pG->lpszPassword );

          /* Null-terminate the string. */
          pG->lpszPassword[pG->cchPassword] = 0;

          /* Call a local password-parsing function. */
          pG->rcode = ZEN_PW_ENTERED;
          EndDialog( hDlg, true );
          return true;
        case IDCANCEL:
          pG->rcode = ZEN_PW_CANCELALL;
          EndDialog( hDlg, true );
          return true;
      } // end inner switch

      return 0;
  }     // end outer switch

  return false;
}