-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit de39b86
Showing
29 changed files
with
6,093 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/** | ||
* AboutDialog.cpp - PuTTYCS About Dialog | ||
* | ||
* Copyright (c) 2005 Jason Millard ([email protected]) | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
* SUCH DAMAGE. | ||
* | ||
* REVISION HISTORY: | ||
* | ||
* 11/05/2005: Initial version J. Millard | ||
*/ | ||
|
||
#include "stdafx.h" | ||
#include "puttycs.h" | ||
#include "AboutDialog.h" | ||
|
||
#ifdef _DEBUG | ||
#define new DEBUG_NEW | ||
#undef THIS_FILE | ||
static char THIS_FILE[] = __FILE__; | ||
#endif | ||
|
||
/** | ||
* CAboutDialog::CAboutDialog() | ||
*/ | ||
|
||
CAboutDialog::CAboutDialog(CWnd* pParent /*=NULL*/) | ||
: CDialog(CAboutDialog::IDD, pParent) | ||
{ | ||
//{{AFX_DATA_INIT(CAboutDialog) | ||
// NOTE: the ClassWizard will add member initialization here | ||
//}}AFX_DATA_INIT | ||
} | ||
|
||
/** | ||
* CAboutDialog::DoDataExchange() | ||
*/ | ||
|
||
void CAboutDialog::DoDataExchange(CDataExchange* pDX) | ||
{ | ||
CDialog::DoDataExchange(pDX); | ||
//{{AFX_DATA_MAP(CAboutDialog) | ||
// NOTE: the ClassWizard will add DDX and DDV calls here | ||
//}}AFX_DATA_MAP | ||
} | ||
|
||
BEGIN_MESSAGE_MAP(CAboutDialog, CDialog) | ||
//{{AFX_MSG_MAP(CAboutDialog) | ||
ON_BN_CLICKED(IDC_VISITWEBSITE_BUTTON, OnVisitWebSiteButton) | ||
ON_BN_CLICKED(IDC_CLOSE_BUTTON, OnOK) | ||
//}}AFX_MSG_MAP | ||
END_MESSAGE_MAP() | ||
|
||
/** | ||
* CAboutDialog::OnInitDialog() | ||
*/ | ||
|
||
BOOL CAboutDialog::OnInitDialog() | ||
{ | ||
CDialog::OnInitDialog(); | ||
|
||
SetDlgItemText( | ||
IDC_ABOUT_TEXT_LINE1, PUTTYCS_ABOUT_TEXT_LINE1 ); | ||
|
||
SetDlgItemText( | ||
IDC_ABOUT_TEXT_LINE2, PUTTYCS_ABOUT_TEXT_LINE2 ); | ||
|
||
return TRUE; | ||
} | ||
|
||
/** | ||
* CAboutDialog::OnVisitWebSiteButton() | ||
*/ | ||
|
||
void CAboutDialog::OnVisitWebSiteButton() | ||
{ | ||
ShellExecute( NULL, | ||
"open", | ||
PUTTYCS_URL_HOMEPAGE, | ||
NULL, | ||
NULL, | ||
SW_SHOWNORMAL ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/** | ||
* AboutDialog.h - PuTTYCS About Dialog header | ||
* | ||
* Copyright (c) 2005 Jason Millard ([email protected]) | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
* SUCH DAMAGE. | ||
* | ||
* REVISION HISTORY: | ||
* | ||
* 11/05/2005: Initial version J. Millard | ||
*/ | ||
|
||
#if !defined(AFX_ABOUTDIALOG_H__F0AE1C5B_A002_4323_855F_204A89B2CD5D__INCLUDED_) | ||
#define AFX_ABOUTDIALOG_H__F0AE1C5B_A002_4323_855F_204A89B2CD5D__INCLUDED_ | ||
|
||
#if _MSC_VER > 1000 | ||
#pragma once | ||
#endif // _MSC_VER > 1000 | ||
|
||
class CAboutDialog : public CDialog | ||
{ | ||
// Construction | ||
public: | ||
CAboutDialog(CWnd* pParent = NULL); // standard constructor | ||
|
||
// Dialog Data | ||
//{{AFX_DATA(CAboutDialog) | ||
enum { IDD = IDD_ABOUT_DIALOG }; | ||
// NOTE: the ClassWizard will add data members here | ||
//}}AFX_DATA | ||
|
||
|
||
// Overrides | ||
// ClassWizard generated virtual function overrides | ||
//{{AFX_VIRTUAL(CAboutDialog) | ||
protected: | ||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support | ||
//}}AFX_VIRTUAL | ||
|
||
// Implementation | ||
protected: | ||
|
||
// Generated message map functions | ||
//{{AFX_MSG(CAboutDialog) | ||
virtual BOOL OnInitDialog(); | ||
afx_msg void OnVisitWebSiteButton(); | ||
//}}AFX_MSG | ||
DECLARE_MESSAGE_MAP() | ||
}; | ||
|
||
//{{AFX_INSERT_LOCATION}} | ||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. | ||
|
||
#endif // !defined(AFX_ABOUTDIALOG_H__F0AE1C5B_A002_4323_855F_204A89B2CD5D__INCLUDED_) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
/** | ||
* Base64.cpp - PuTTYCS BASE64 Encoder/Decoder | ||
* | ||
* This code is based HEAVILY on the code found at: | ||
* http://www.adp-gmbh.ch/cpp/common/base64.html | ||
* | ||
* Copyright (c) 2005 Jason Millard ([email protected]) | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
* SUCH DAMAGE. | ||
* | ||
* REVISION HISTORY: | ||
* | ||
* 11/05/2005: Initial version J. Millard | ||
*/ | ||
|
||
#include "stdafx.h" | ||
#include "puttycs.h" | ||
#include "Base64.h" | ||
|
||
#ifdef _DEBUG | ||
#undef THIS_FILE | ||
static char THIS_FILE[]=__FILE__; | ||
#define new DEBUG_NEW | ||
#endif | ||
|
||
CString CBase64::BASE64_CHARS = | ||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | ||
|
||
/** | ||
* CBase64::encode() | ||
*/ | ||
|
||
CString CBase64::encode( CString csBuffer ) | ||
{ | ||
CString csValue = ""; | ||
|
||
unsigned char buffer3[3]; | ||
unsigned char buffer4[4]; | ||
|
||
char* bytes = csBuffer.GetBuffer(0); | ||
int pos = csBuffer.GetLength(); | ||
|
||
int i = 0; | ||
int j = 0; | ||
|
||
while ( pos-- ) | ||
{ | ||
buffer3[i++] = *(bytes++); | ||
|
||
if (i == 3) | ||
{ | ||
buffer4[0] = (buffer3[0] & 0xfc) >> 2; | ||
|
||
buffer4[1] = | ||
((buffer3[0] & 0x03) << 4) + | ||
((buffer3[1] & 0xf0) >> 4); | ||
|
||
buffer4[2] = | ||
((buffer3[1] & 0x0f) << 2) + | ||
((buffer3[2] & 0xc0) >> 6); | ||
|
||
buffer4[3] = buffer3[2] & 0x3f; | ||
|
||
for( i = 0; (i <4) ; i++ ) | ||
{ | ||
csValue += | ||
BASE64_CHARS.GetAt( buffer4[i] ); | ||
} | ||
|
||
i = 0; | ||
} | ||
} | ||
|
||
if (i) | ||
{ | ||
for( j = i; j < 3; j++ ) | ||
{ | ||
buffer3[j] = '\0'; | ||
} | ||
|
||
buffer4[0] = | ||
(buffer3[0] & 0xfc) >> 2; | ||
|
||
buffer4[1] = | ||
((buffer3[0] & 0x03) << 4) + | ||
((buffer3[1] & 0xf0) >> 4); | ||
|
||
buffer4[2] = | ||
((buffer3[1] & 0x0f) << 2) + | ||
((buffer3[2] & 0xc0) >> 6); | ||
|
||
buffer4[3] = buffer3[2] & 0x3f; | ||
|
||
for ( j = 0; (j < i + 1); j++ ) | ||
{ | ||
csValue += | ||
BASE64_CHARS.GetAt( buffer4[j] ); | ||
} | ||
|
||
while( (i++ < 3) ) | ||
{ | ||
csValue += '='; | ||
} | ||
} | ||
|
||
return csValue; | ||
} | ||
|
||
/** | ||
* CBase64::decode() | ||
*/ | ||
|
||
CString CBase64::decode( CString csBuffer ) | ||
{ | ||
CString csValue = ""; | ||
|
||
unsigned char buffer4[4]; | ||
unsigned char buffer3[3]; | ||
|
||
int pos = csBuffer.GetLength(); | ||
int offset = 0; | ||
|
||
int i = 0; | ||
int j = 0; | ||
|
||
while ( (pos--) && ( | ||
BASE64_CHARS.Find(csBuffer.GetAt(offset)) != -1) ) | ||
{ | ||
buffer4[i++] = | ||
csBuffer.GetAt(offset++); | ||
|
||
if ( i == 4 ) | ||
{ | ||
for ( i = 0; i < 4; i++ ) | ||
{ | ||
buffer4[i] = | ||
BASE64_CHARS.Find( buffer4[i] ); | ||
} | ||
|
||
buffer3[0] = | ||
(buffer4[0] << 2) + | ||
((buffer4[1] & 0x30) >> 4); | ||
|
||
buffer3[1] = | ||
((buffer4[1] & 0xf) << 4) + | ||
((buffer4[2] & 0x3c) >> 2); | ||
|
||
buffer3[2] = | ||
((buffer4[2] & 0x3) << 6) + | ||
buffer4[3]; | ||
|
||
for ( i = 0; (i < 3); i++ ) | ||
{ | ||
csValue += buffer3[i]; | ||
} | ||
|
||
i = 0; | ||
} | ||
} | ||
|
||
if (i) | ||
{ | ||
for ( j = i; j < 4; j++ ) | ||
{ | ||
buffer4[j] = 0; | ||
} | ||
|
||
for ( j = 0; j < 4; j++ ) | ||
{ | ||
buffer4[j] = | ||
BASE64_CHARS.Find( buffer4[j]) ; | ||
} | ||
|
||
buffer3[0] = | ||
(buffer4[0] << 2) + | ||
((buffer4[1] & 0x30) >> 4); | ||
|
||
buffer3[1] = | ||
((buffer4[1] & 0xf) << 4) + | ||
((buffer4[2] & 0x3c) >> 2); | ||
|
||
buffer3[2] = | ||
((buffer4[2] & 0x3) << 6) + | ||
buffer4[3]; | ||
|
||
for ( j = 0; (j < i - 1); j++ ) | ||
{ | ||
csValue += buffer3[j]; | ||
} | ||
} | ||
|
||
return csValue; | ||
} |
Oops, something went wrong.