Author: mturk
Date: Tue Feb 2 12:41:06 2010
New Revision: 905608
URL: http://svn.apache.org/viewvc?rev=905608&view=rev
Log:
Add standard About dialog
Added:
commons/sandbox/runtime/trunk/src/main/native/support/win32/commons.bmp
(with props)
commons/sandbox/runtime/trunk/src/main/native/support/win32/license.rtf
Modified:
commons/sandbox/runtime/trunk/src/main/native/support/win32/suexec.c
commons/sandbox/runtime/trunk/src/main/native/support/win32/support.rc
Added: commons/sandbox/runtime/trunk/src/main/native/support/win32/commons.bmp
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/support/win32/commons.bmp?rev=905608&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
commons/sandbox/runtime/trunk/src/main/native/support/win32/commons.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: commons/sandbox/runtime/trunk/src/main/native/support/win32/license.rtf
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/support/win32/license.rtf?rev=905608&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/support/win32/license.rtf
(added)
+++ commons/sandbox/runtime/trunk/src/main/native/support/win32/license.rtf Tue
Feb 2 12:41:06 2010
@@ -0,0 +1,33 @@
+{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset238\fprq2{\*\panose
02020603050405020304}Times New Roman;}
+{\f1\fswiss\fcharset238\fprq2{\*\panose
020b0604020202020204}Arial;}{\f39\froman\fcharset0\fprq2 Times New
Roman;}{\f38\froman\fcharset204\fprq2 Times New Roman
Cyr;}{\f40\froman\fcharset161\fprq2 Times New Roman Greek;}
+{\f41\froman\fcharset162\fprq2 Times New Roman
Tur;}{\f42\froman\fcharset177\fprq2 Times New Roman
(Hebrew);}{\f43\froman\fcharset178\fprq2 Times New Roman
(Arabic);}{\f44\froman\fcharset186\fprq2 Times New Roman Baltic;}
+{\f45\froman\fcharset163\fprq2 Times New Roman
(Vietnamese);}{\f49\fswiss\fcharset0\fprq2
Arial;}{\f48\fswiss\fcharset204\fprq2 Arial Cyr;}{\f50\fswiss\fcharset161\fprq2
Arial Greek;}{\f51\fswiss\fcharset162\fprq2 Arial Tur;}
+{\f52\fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f53\fswiss\fcharset178\fprq2
Arial (Arabic);}{\f54\fswiss\fcharset186\fprq2 Arial
Baltic;}{\f55\fswiss\fcharset163\fprq2 Arial
(Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql
\li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0
Normal;}{\*\cs10 \additive
+\ssemihidden Default Paragraph
Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden
Normal Table;}{\*\cs15 \additive \ul\cf2 \sbasedon10 Hyperlink;}}
+{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl
\rsid1379267\rsid3345586\rsid5638524\rsid6496053\rsid6510316\rsid6697379\rsid7028353\rsid9000330\rsid9454304\rsid10124145\rsid10819759\rsid12321742\rsid12593955\rsid14358633\rsid15670059\rsid16132583
+}{\*\generator Microsoft Word 11.0.5604;}{\info{\author Mladen Turk}{\operator
Mladen
Turk}{\creatim\yr2003\mo4\dy9\hr14\min37}{\revtim\yr2004\mo4\dy7\hr8\min42}{\version14}{\edmins11}{\nofpages1}{\nofwords96}{\nofchars549}
+{\*\company Apache Software
Foundation}{\nofcharsws644}{\vern24689}}\margl1417\margr1417\margt1417\margb1417
\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701
+\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind4\viewscale100\nolnhtadjtbl\rsidroot9000330
\fet0\sectd \linex0\sectdefaultcl\sftnbj
{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta
.}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang
+{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta
.}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta
)}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta
)}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang
+{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang
{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang
{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang
{\pntxtb (}{\pntxta )}}\pard\plain
+\qc \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0\pararsid14358633
\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033
{\b\f1\insrsid16132583\charrsid12321742 The Apache Software License, Version 2.0
+\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0
{\f1\fs18\insrsid16132583\charrsid16132583
+\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0\pararsid9454304
{\f1\fs18\insrsid9454304 }{\f1\fs18\insrsid16132583\charrsid16132583
Copyright 2002-2010 The Apache Software Foundation.
+\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0\pararsid1379267
{\f1\fs18\insrsid16132583\charrsid16132583
+\par }{\f1\fs18\insrsid14358633 }{\f1\fs18\insrsid16132583\charrsid16132583
Licensed under the Apache License, Version 2.0 (the "License");
+\par }{\f1\fs18\insrsid14358633 }{\f1\fs18\insrsid16132583\charrsid16132583
you may not use this file except in compliance with the License.
+\par }{\f1\fs18\insrsid14358633 }{\f1\fs18\insrsid16132583\charrsid16132583
You may obtain a copy of the License at
+\par }{\f1\fs18\insrsid12593955
+\par }{\f1\fs18\insrsid16132583\charrsid16132583
+\par }{\cf2\insrsid6510316 }{\ul\cf2\insrsid16132583\charrsid6510316
http://www.apache.org/licenses/LICENSE-2.0
+\par }{\f1\fs18\insrsid12593955
+\par
+\par }{\f1\fs18\insrsid12321742 \line }{\f1\fs18\insrsid14358633
}{\f1\fs18\insrsid16132583\charrsid16132583 Unless required by applicable law
or agreed to in writing, software
+\par }{\f1\fs18\insrsid14358633 }{\f1\fs18\insrsid16132583\charrsid16132583
distributed under the License is distributed on an "AS IS"
BASIS,}{\f1\fs18\insrsid14358633 }{\f1\fs18\insrsid16132583\charrsid16132583
+\par }{\f1\fs18\insrsid14358633 }{\f1\fs18\insrsid16132583\charrsid16132583
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+\par }{\f1\fs18\insrsid14358633 }{\f1\fs18\insrsid16132583\charrsid16132583
See the License for the specific language governing permissions and
+\par }{\f1\fs18\insrsid14358633 }{\f1\fs18\insrsid14358633\charrsid16132583
L}{\f1\fs18\insrsid16132583\charrsid16132583 imitations under the License.
+\par }}
\ No newline at end of file
Modified: commons/sandbox/runtime/trunk/src/main/native/support/win32/suexec.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/support/win32/suexec.c?rev=905608&r1=905607&r2=905608&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/support/win32/suexec.c
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/support/win32/suexec.c Tue
Feb 2 12:41:06 2010
@@ -34,6 +34,7 @@
#include "acr.h"
#include "acr_private.h"
#include "acr_arch.h"
+#include "richedit.h"
#include "suexec.h"
/*
@@ -78,6 +79,15 @@
#define PIPE_STDERR_RDS 4
#define PIPE_STDERR_WRS 5
+#define IDI_MAINICON 101
+#define IDS_APPLICATION 150
+#define IDS_APPVERSION 151
+#define IDS_APPFULLNAME 152
+#define IDD_ABOUTBOX 250
+#define IDC_LICENSE 251
+#define IDR_LICENSE 252
+#define IAB_SYSINF 253
+#define IDC_ABOUTAPP 254
#define INCH() \
do { \
@@ -178,9 +188,9 @@
NULL
};
-static HANDLE hCurrentProcess = NULL;
-static HANDLE hSharedMemory = NULL;
-
+static HANDLE hCurrentProcess = NULL;
+static HANDLE hSharedMemory = NULL;
+static HINSTANCE hCurrentInstance = NULL;
/* We need to expand this string
* It contains the minimum path needed for running the
* any CGI application.
@@ -1526,6 +1536,147 @@
return NULL;
}
+LPWSTR LoadResourceW(UINT wID, UINT nBuf)
+
+{
+ static WCHAR szBuf[4][4096];
+ if (nBuf > 4)
+ return L"";
+ if (LoadStringW(hCurrentInstance, wID , szBuf[nBuf], 4096) > 0)
+ return szBuf[nBuf];
+ else
+ return L"";
+}
+
+static void ShowShellAbout(HWND hWnd)
+{
+ TCHAR szApplication[512];
+
+ LoadLibraryW(L"RICHED32.DLL");
+
+ _snwprintf(szApplication , 512,
+ L"About - %s#Windows",
+ LoadResourceW(IDS_APPLICATION, 0));
+ ShellAbout(hWnd, szApplication,
+ LoadResourceW(IDS_APPFULLNAME, 1),
+ LoadImage(hCurrentInstance,
+ MAKEINTRESOURCE(IDI_MAINICON),
+ IMAGE_ICON, 48, 48, LR_DEFAULTCOLOR));
+}
+
+static BOOL CenterWindow(HWND hwndChild, HWND hwndParent)
+{
+ RECT rChild, rParent, rWorkArea;
+ int wChild, hChild, wParent, hParent;
+ int xNew, yNew;
+ BOOL bResult;
+
+ /* Get the Height and Width of the child window */
+ GetWindowRect(hwndChild, &rChild);
+ wChild = rChild.right - rChild.left;
+ hChild = rChild.bottom - rChild.top;
+
+ /* Get the Height and Width of the parent window */
+ GetWindowRect(hwndParent, &rParent);
+ wParent = rParent.right - rParent.left;
+ hParent = rParent.bottom - rParent.top;
+
+ if (wParent < wChild && hParent < hChild) {
+ GetWindowRect(GetDesktopWindow(), &rParent);
+ wParent = rParent.right - rParent.left;
+ hParent = rParent.bottom - rParent.top;
+ }
+ /* Get the limits of the 'workarea' */
+ bResult = SystemParametersInfo(SPI_GETWORKAREA, sizeof(RECT),
+ &rWorkArea, 0);
+ if (!bResult) {
+ rWorkArea.left = rWorkArea.top = 0;
+ rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
+ rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
+ }
+
+ /* Calculate new X position, then adjust for workarea */
+ xNew = rParent.left + ((wParent - wChild) /2);
+ if (xNew < rWorkArea.left)
+ xNew = rWorkArea.left;
+ else if ((xNew+wChild) > rWorkArea.right)
+ xNew = rWorkArea.right - wChild;
+
+ /* Calculate new Y position, then adjust for workarea */
+ yNew = rParent.top + ((hParent - hChild) /2);
+ if (yNew < rWorkArea.top)
+ yNew = rWorkArea.top;
+ else if ((yNew+hChild) > rWorkArea.bottom)
+ yNew = rWorkArea.bottom - hChild;
+
+ /* Set it, and return */
+ return SetWindowPos(hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE |
SWP_NOZORDER);
+}
+
+static LRESULT CALLBACK AboutDlgProc(HWND hDlg, UINT uMsg,
+ WPARAM wParam, LPARAM lParam)
+{
+ static HWND hRich = NULL;
+ static POINT ptScroll;
+ HRSRC hRsrc;
+ HGLOBAL hGlob;
+ LPSTR szTxt;
+ UINT ucNumLines = 3; /* 3 is the default */
+
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ CenterWindow(hDlg, GetDesktopWindow());
+ hRich = GetDlgItem(hDlg, IDC_LICENSE);
+ hRsrc = FindResource(hCurrentInstance,
MAKEINTRESOURCE(IDR_LICENSE),
+ L"RTF");
+ hGlob = LoadResource(hCurrentInstance, hRsrc);
+ szTxt = (LPSTR)LockResource(hGlob);
+
+ SendMessageA(hRich, WM_SETTEXT, 0, (LPARAM)szTxt);
+ SetDlgItemTextW(hDlg, IDC_ABOUTAPP, LoadResourceW(IDS_APPFULLNAME,
0));
+ ptScroll.x = 0;
+ ptScroll.y = 0;
+ SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0,
+ &ucNumLines, 0);
+ return TRUE;
+ break;
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
+ EndDialog(hDlg, LOWORD(wParam));
+ return TRUE;
+ }
+ else if (LOWORD(wParam) == IAB_SYSINF)
+ ShowShellAbout(hDlg);
+ break;
+ case WM_MOUSEWHEEL:
+ {
+ int nScroll, nLines;
+ if ((SHORT)HIWORD(wParam) < 0)
+ nScroll = ucNumLines;
+ else
+ nScroll = ucNumLines * (-1);
+ ptScroll.y += (nScroll * 11);
+ if (ptScroll.y < 0)
+ ptScroll.y = 0;
+ nLines = (int)SendMessage(hRich, EM_GETLINECOUNT, 0, 0) + 1;
+ if (ptScroll.y / 11 > nLines)
+ ptScroll.y = nLines * 11;
+ SendMessage(hRich, EM_SETSCROLLPOS, 0, (LPARAM)&ptScroll);
+ }
+ break;
+ }
+ return FALSE;
+}
+
+static void AboutBox(HWND hWnd)
+{
+ LoadLibraryW(L"RICHED32.DLL");
+ DialogBox(hCurrentInstance,
+ MAKEINTRESOURCE(IDD_ABOUTBOX),
+ hWnd,
+ (DLGPROC)AboutDlgProc);
+}
+
typedef NTSTATUS (NTAPI *pfnNtCreateToken)(
OUT PHANDLE TokenHandle,
IN ACCESS_MASK DesiredAccess,
@@ -1684,6 +1835,8 @@
DBG_PRINTF((__LINE__, "[ERROR] CommandLineToArrayW err=%d",
GetLastError()));
goto cleanup;
}
+ if (!(hCurrentInstance = hInstance))
+ hCurrentInstance = GetModuleHandleW(NULL);
argv = args;
for (i = 0; i < argc; i++) {
if (args[i][0] == L'-' && args[i][1] == L'-' && args[i][2]) {
@@ -1692,7 +1845,12 @@
LPWSTR cep;
if ((val = wcschr(opt, L'=')))
*val++;
- if (*opt == L'f') {
+ if (*opt == L'a') {
+ AboutBox(GetDesktopWindow());
+ rc = 0;
+ goto cleanup;
+ }
+ else if (*opt == L'f') {
if (val && *val) {
dwParentPid = (DWORD)wcstoul(val, &cep, 10);
if (*cep && *cep == L':') {
Modified: commons/sandbox/runtime/trunk/src/main/native/support/win32/support.rc
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/support/win32/support.rc?rev=905608&r1=905607&r2=905608&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/support/win32/support.rc
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/support/win32/support.rc Tue
Feb 2 12:41:06 2010
@@ -74,20 +74,28 @@
#define APP_FILEFLAGS STD_FILEFLAGS
#endif
+#define IDC_STATIC -1
#define IDI_MAINICON 101
#define IDS_APPLICATION 150
#define IDS_APPVERSION 151
#define IDS_APPFULLNAME 152
#define IDS_APPCOPYRIGHT 153
+#define IDD_ABOUTBOX 250
+#define IDC_LICENSE 251
+#define IDR_LICENSE 252
+#define IAB_SYSINF 253
+#define IDC_ABOUTAPP 254
#ifndef STR_ICONAME
#define STR_ICONAME "apache.ico"
#endif
IDI_MAINICON ICON STR_ICONAME
+IDR_LICENSE RTF "license.rtf"
+BMP_JAKARTA BITMAP "commons.bmp"
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "commonc.manifest"
-STRINGTABLE
+STRINGTABLE
BEGIN
IDS_APPLICATION STR_INTNAME
IDS_APPVERSION "Version " ACR_VERSION_STRING
@@ -95,6 +103,21 @@
IDS_APPCOPYRIGHT STR_COPYRIGHT
END
+IDD_ABOUTBOX DIALOGEX 0, 0, 337, 187
+STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION STR_PRODUCT
+FONT 8, "Microsoft Sans Serif", 400, 0, 0x0
+BEGIN
+ DEFPUSHBUTTON "&OK",IDOK,285,150,50,14
+ CONTROL "",IDC_LICENSE,"RichEdit20A",ES_MULTILINE |
+ ES_READONLY | WS_BORDER | WS_VSCROLL,0,31,335,115
+ CONTROL
"BMP_JAKARTA",IDC_STATIC,"Static",SS_BITMAP|0x00000040L,0,0,337,30
+ LTEXT " ",IDC_ABOUTAPP,2,150,270,12
+ LTEXT "Copyright © 2000-2019 The Apache Software
Foundation.",IDC_STATIC,2,160,270,12
+ LTEXT "http://commons.apache.org",IDC_STATIC,2,170,270,12
+ PUSHBUTTON "&System Info",IAB_SYSINF,285,170,50,14
+END
+
1 VERSIONINFO
FILEVERSION ACR_VERSION_STRING_CSV
PRODUCTVERSION ACR_VERSION_STRING_CSV