Add error reporting assistant.
Modified: trunk/reactos/Makefile
Modified: trunk/reactos/bootdata/packages/reactos.dff
Added: trunk/reactos/subsys/system/reporterror/
Added: trunk/reactos/subsys/system/reporterror/En.rc
Added: trunk/reactos/subsys/system/reporterror/Makefile
Added: trunk/reactos/subsys/system/reporterror/manifest.xml
Added: trunk/reactos/subsys/system/reporterror/reporterror.c
Added: trunk/reactos/subsys/system/reporterror/reporterror.h
Added: trunk/reactos/subsys/system/reporterror/reporterror.rc
Added: trunk/reactos/subsys/system/reporterror/resources/
Added: trunk/reactos/subsys/system/reporterror/resources/header.bmp
Added: trunk/reactos/subsys/system/reporterror/resources/watermark.bmp

Modified: trunk/reactos/Makefile
--- trunk/reactos/Makefile	2005-01-01 01:03:31 UTC (rev 12673)
+++ trunk/reactos/Makefile	2005-01-01 01:11:54 UTC (rev 12674)
@@ -1,4 +1,3 @@
-# $Id$
 #
 # Global makefile
 #
@@ -101,8 +100,8 @@
 # System applications
 # autochk cmd format services setup usetup welcome winlogon msiexec 
 SYS_APPS = autochk calc cmd explorer expand format regedt32 regsvr32 \
-  services setup taskmgr userinit usetup welcome vmwinst winlogon \
-  regedit winefile notepad reactos
+  reporterror services setup taskmgr userinit usetup welcome vmwinst \
+  winlogon regedit winefile notepad reactos
 
 # System services
 # rpcss eventlog

Modified: trunk/reactos/bootdata/packages/reactos.dff
--- trunk/reactos/bootdata/packages/reactos.dff	2005-01-01 01:03:31 UTC (rev 12673)
+++ trunk/reactos/bootdata/packages/reactos.dff	2005-01-01 01:11:54 UTC (rev 12674)
@@ -148,6 +148,7 @@
 subsys\system\regedit\regedit.exe       4
 subsys\system\regedt32\regedt32.exe     1
 subsys\system\regsvr32\regsvr32.exe     1
+subsys\system\reporterror\reporterror.exe 1
 subsys\system\services\services.exe     1
 subsys\system\setup\setup.exe           1
 subsys\system\taskmgr\taskmgr.exe       1
Property changes on: trunk/reactos/subsys/system/reporterror
___________________________________________________________________
Name: svn:ignore
   + *.coff
*.map
*.exe
*.sym
*.a

Added: trunk/reactos/subsys/system/reporterror/En.rc
--- trunk/reactos/subsys/system/reporterror/En.rc	2005-01-01 01:03:31 UTC (rev 12673)
+++ trunk/reactos/subsys/system/reporterror/En.rc	2005-01-01 01:11:54 UTC (rev 12674)
@@ -0,0 +1,53 @@
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+IDD_FIRSTPAGE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Error reporting assistant"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+  LTEXT "The system recovered from an error.", -1, 115, 15, 160, 24
+  LTEXT "Would you like to report the error to the ReactOS project?", -1, 115, 35, 160, 17
+END
+
+IDD_SUBMIT_REPORT DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Error reporting assistant"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+  LTEXT "Please describe what you were trying to do when the error occurred.\n\nClick 'Next' to send the report to the ReacOS project or 'Cancel' to not send any information.",-1,10,0,225,40
+  LTEXT "Your e-mail address (optional):",-1,10,40,120,20
+  EDITTEXT IDE_SUBMIT_REPORT_YOUR_EMAIL, 110,40,150,12
+  LTEXT "Description of problem (optional):",-1,10,55,120,20
+  EDITTEXT IDE_SUBMIT_REPORT_PROBLEM_DESCRIPTION,10,65,250,55,ES_WANTRETURN|ES_MULTILINE|ES_LEFT|WS_BORDER|WS_TABSTOP|WS_VSCROLL
+END
+
+IDD_SUBMITTING_REPORT DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Error reporting assistant"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+  LTEXT "{STATUS}",IDC_SUBMISSION_STATUS,25,58,225,8
+  CONTROL "", IDC_SUBMITTING_IN_PROGRESS, "msctls_progress32", PBS_MARQUEE | WS_CHILD | WS_VISIBLE | WS_BORDER, 25, 80, 225, 8
+END
+
+IDD_SUBMITTED_REPORT DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Error reporting assistant"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+  LTEXT "Your error report was successfully sent to the ReactOS project.",-1,25,5,225,20
+END
+
+STRINGTABLE
+BEGIN
+  IDS_WIZARD_NAME "Report error to the ReactOS project"
+  IDS_FAILED_TO_CONTACT_SERVER "The system was unable to contact the error reporting server.\nPlease make sure that your system is connected to the internet."
+  IDS_FAILED_TO_DELIVER_ERROR_REPORT "The system was unable to deliver the error report."
+END
+
+STRINGTABLE
+BEGIN
+  IDS_CONTACTING_SERVER "Contacting error reporting server..."
+  IDS_FAILED_TO_INITIALIZE_WINSOCK "Failed to initialize winsock (windows error code %d)"
+  IDS_FAILED_TO_LOCATE_SERVER "Failed to contact error reporting server"
+END

Added: trunk/reactos/subsys/system/reporterror/Makefile
--- trunk/reactos/subsys/system/reporterror/Makefile	2005-01-01 01:03:31 UTC (rev 12673)
+++ trunk/reactos/subsys/system/reporterror/Makefile	2005-01-01 01:11:54 UTC (rev 12674)
@@ -0,0 +1,20 @@
+PATH_TO_TOP = ../../..
+
+TARGET_TYPE = program
+
+TARGET_APPTYPE = windows
+
+TARGET_NAME = reporterror
+
+TARGET_INSTALLDIR = system32
+
+TARGET_CFLAGS = -D__USE_W32API -DUNICODE -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501
+
+TARGET_SDKLIBS = advapi32.a comctl32.a comdlg32.a shell32.a ws2_32.a
+
+TARGET_OBJECTS = \
+  $(TARGET_NAME).o
+
+include $(PATH_TO_TOP)/rules.mak
+
+include $(TOOLS_PATH)/helper.mk

Added: trunk/reactos/subsys/system/reporterror/manifest.xml
--- trunk/reactos/subsys/system/reporterror/manifest.xml	2005-01-01 01:03:31 UTC (rev 12673)
+++ trunk/reactos/subsys/system/reporterror/manifest.xml	2005-01-01 01:11:54 UTC (rev 12674)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity
+  version="1.0.0.0"
+  processorArchitecture="X86"
+  name="ReactOS.ErrorReport"
+  type="win32"
+ />
+ <description>ReactOS Error Reporting Assistant</description>
+ <dependency>
+  <dependentAssembly>
+   <assemblyIdentity
+    type="win32"
+    name="Microsoft.Windows.Common-Controls"
+    version="6.0.0.0"
+    processorArchitecture="X86"
+    publicKeyToken="6595b64144ccf1df"
+    language="*"
+   />
+  </dependentAssembly>
+ </dependency>
+</assembly>

Added: trunk/reactos/subsys/system/reporterror/reporterror.c
--- trunk/reactos/subsys/system/reporterror/reporterror.c	2005-01-01 01:03:31 UTC (rev 12673)
+++ trunk/reactos/subsys/system/reporterror/reporterror.c	2005-01-01 01:11:54 UTC (rev 12674)
@@ -0,0 +1,613 @@
+/*
+ * ReactOS Error Reporting Assistant
+ * Copyright (C) 2004-2005 Casper S. Hornstrup <chorns@users.sourceforge.net>
+ * Copyright (C) 2003-2004 Peter Willis <psyphreak@phreaker.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/*
+ * COPYRIGHT:   See COPYING in the top level directory
+ * PROJECT:     ReactOS Error Reporting Assistant
+ * FILE:        subsys/system/reporterror/reporterror.c
+ * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
+ *              Thomas Weidenmueller (w3seek@users.sourceforge.net)
+ */
+#include <windows.h>
+#include <commctrl.h>
+#include <stdio.h>
+#include <string.h>
+#include "reporterror.h"
+
+static LPSTR ErrorReportingServerName = "errors.reactos.com";
+static HINSTANCE hAppInstance;
+static HANDLE hSubmissionThread = NULL;
+static HWND hSubmissionNotifyWnd = NULL;
+static LONG AbortSubmission = 0;
+static LPERROR_REPORT ErrorReport = NULL;
+
+#define WM_ABORT_SUBMISSION (WM_USER + 2)
+#define WM_CONTACTING_SERVER (WM_USER + 3)
+#define WM_SUBMISSION_COMPLETE (WM_USER + 4)
+
+#define MAX_REQUEST_BUFFER_SIZE 20480
+
+LPSTR
+UrlEncode(LPSTR in, LPSTR out)
+{
+  CHAR buffer[4];
+  UCHAR iu;
+  INT i;
+
+  for (i = 0; i < strlen(in); i++)
+  {
+    iu = (UCHAR)in[i];
+    memset(buffer, '\0', sizeof(buffer));
+    if ((iu < 33 || iu > 126))
+      sprintf(buffer, "%%%02x", iu);
+    else
+      sprintf(buffer, "%c", iu);
+    strcat(out, buffer);
+  }
+  return out;
+}
+
+LPERROR_REPORT
+FillErrorReport(HWND hwndDlg)
+{
+  INT size;
+  LPERROR_REPORT errorReport = malloc(sizeof(ERROR_REPORT));
+
+  size = 300;
+  errorReport->YourEmail = malloc(size);
+  GetDlgItemTextA(hwndDlg,
+    IDE_SUBMIT_REPORT_YOUR_EMAIL,
+    errorReport->YourEmail,
+    size);
+
+  size = 10240;
+  errorReport->ProblemDescription = malloc(size);
+  GetDlgItemTextA(hwndDlg,
+    IDE_SUBMIT_REPORT_PROBLEM_DESCRIPTION,
+    errorReport->ProblemDescription,
+    size);
+
+  return errorReport;
+}
+
+ReleaseErrorReport(LPERROR_REPORT errorReport)
+{
+  if (errorReport->YourEmail)
+    free(errorReport->YourEmail);
+  if (errorReport->ProblemDescription)
+    free(errorReport->ProblemDescription);
+  free(errorReport);
+}
+
+BOOL
+ProcessMessage(VOID)
+{
+  MSG msg;
+  if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+  {
+    TranslateMessage(&msg);
+    DispatchMessage(&msg);
+    return TRUE;
+  }
+  return FALSE;
+}
+
+VOID
+ProcessMessages(VOID)
+{
+  while (ProcessMessage());
+}
+
+VOID
+InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DWORD Flags, DLGPROC DlgProc)
+{
+  ZeroMemory(psp, sizeof(PROPSHEETPAGE));
+  psp->dwSize = sizeof(PROPSHEETPAGE);
+  psp->dwFlags = PSP_DEFAULT | Flags;
+  psp->hInstance = hAppInstance;
+  psp->pszTemplate = MAKEINTRESOURCE(idDlg);
+  psp->pfnDlgProc = DlgProc;
+}
+
+INT_PTR CALLBACK
+PageFirstPageProc(
+  HWND hwndDlg,
+  UINT uMsg,
+  WPARAM wParam,
+  LPARAM lParam)
+{
+  switch(uMsg)
+  {
+    case WM_NOTIFY:
+    {
+      LPNMHDR pnmh = (LPNMHDR)lParam;
+      switch (pnmh->code)
+      {
+        case PSN_SETACTIVE:
+        {
+          PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
+          break;
+        }
+        case PSN_WIZNEXT:
+        {
+          SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SUBMIT_REPORT);
+          return TRUE;
+        }
+      }
+      break;
+    }
+  }
+  return FALSE;
+}
+
+INT_PTR CALLBACK
+PageSubmitReportProc(
+  HWND hwndDlg,
+  UINT uMsg,
+  WPARAM wParam,
+  LPARAM lParam)
+{
+  switch (uMsg)
+  {
+    case WM_NOTIFY:
+    {
+      LPNMHDR pnmh = (LPNMHDR)lParam;
+      switch (pnmh->code)
+      {
+        case PSN_SETACTIVE:
+        {
+          PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
+          break;
+        }
+        case PSN_WIZNEXT:
+        {
+          ErrorReport = FillErrorReport(hwndDlg);
+          SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SUBMITTING_REPORT);
+          break;
+        }
+      }
+      break;
+    }
+  }
+  return FALSE;
+}
+
+VOID
+TerminateSubmission(BOOL Wait)
+{
+  if (hSubmissionThread != NULL)
+  {
+    if (Wait)
+    {
+      InterlockedExchange((LONG*)&AbortSubmission, 2);
+      WaitForSingleObject(hSubmissionThread, INFINITE);
+    }
+    else
+      InterlockedExchange((LONG*)&AbortSubmission, 1);
+  }
+}
+
+INT
+ConnectToServer(LPSTR host,
+  SOCKET *clientSocket,
+  LPWSTR errorMessage)
+{
+	struct sockaddr_in sin;
+	struct hostent *hp;
+	struct servent *sp;
+	INT error;
+  SOCKET s;
+
+  *clientSocket = 0;
+
+	hp = gethostbyname(host);
+	if (hp == NULL)
+  {
+    error = WSAGetLastError();
+    wsprintf(errorMessage, L"Could not resolve DNS for %S (windows error code %d)", host, error);
+    return error;
+	}
+
+	s = socket(hp->h_addrtype, SOCK_STREAM, 0);
+	if (s < 0)
+  {
+    error = WSAGetLastError();
+    wsprintf(errorMessage, L"Could not create socket (windows error code %d)", error);
+    return error;
+	}
+
+	memset(&sin, 0, sizeof(sin));
+	sin.sin_family = hp->h_addrtype;
+	if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0)
+  {
+    error = WSAGetLastError();
+    wsprintf(errorMessage, L"Could not resolve DNS for %S (windows error code %d)", host, error);
+    closesocket(s);
+    return error;
+	}
+
+	memcpy((char *)&sin.sin_addr, hp->h_addr, hp->h_length);
+	sp = getservbyname("www", "tcp");
+	if (sp == NULL)
+  {
+    error = WSAGetLastError();
+    wsprintf(errorMessage, L"Could not get service (windows error code %d)", error);
+    closesocket(s);
+    return error;
+	}
+
+	sin.sin_port = sp->s_port;
+
+	if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0)
+  {
+    error = WSAGetLastError();
+    wsprintf(errorMessage, L"Could not connect to server (windows error code %d)", error);
+    closesocket(s);
+    return error;
+	}
+
+  *clientSocket = s;
+  return NO_ERROR;
+}
+
+VOID
+CreateHTTPPostRequest(LPSTR requestBuffer,
+  LPSTR hostname,
+  LPERROR_REPORT errorReport)
+{
+  LPSTR parameterBuffer;
+  LPSTR urlencodeBuffer;
+
+  parameterBuffer = malloc(MAX_REQUEST_BUFFER_SIZE);
+  memset(parameterBuffer, '\0', MAX_REQUEST_BUFFER_SIZE);
+
+  strcat(parameterBuffer, "errorReport=");
+  strcat(parameterBuffer, "<ErrorReportResponse>");
+  strcat(parameterBuffer, "<YourEmail>");
+  strcat(parameterBuffer, errorReport->YourEmail);
+  strcat(parameterBuffer, "</YourEmail>");
+  strcat(parameterBuffer, "<ProblemDescription>");
+  strcat(parameterBuffer, errorReport->ProblemDescription);
+  strcat(parameterBuffer, "</ProblemDescription>");
+  strcat(parameterBuffer, "</ErrorReportResponse>");
+  strcat(parameterBuffer, "\r\n");
+
+  urlencodeBuffer = malloc(MAX_REQUEST_BUFFER_SIZE);
+  memset(urlencodeBuffer, '\0', MAX_REQUEST_BUFFER_SIZE);
+
+  UrlEncode(parameterBuffer, urlencodeBuffer);
+  sprintf(requestBuffer, "POST /Report.asmx/SubmitErrorReport HTTP/1.1\r\n"
+                         "Host: %s\r\n"
+                         "Content-Type: application/x-www-form-urlencoded\r\n"
+                         "Content-Length: %d\r\n"
+                         "\r\n"
+                         "%s",
+    hostname,
+    strlen(urlencodeBuffer),
+    urlencodeBuffer);
+
+  free(urlencodeBuffer);
+  free(parameterBuffer);
+}
+
+#define CONTENT_LENGTH "Content-Length:"
+
+BOOL
+WasErrorReportDelivered(LPSTR httpResponse)
+{
+
+  return strstr(httpResponse, "&lt;/ErrorReportResponse&gt;") != NULL;
+}
+
+BOOL
+ReceiveResponse(SOCKET socket, LPSTR responseBuffer, PULONG responseBufferSize)
+{
+  PCHAR pch = (PCHAR)responseBuffer;
+  ULONG length = 0;
+  INT contentLength = 0;
+  fd_set fdset[1];
+  struct timeval timeout;
+  CHAR buf[4000];
+
+  FD_ZERO(&fdset);
+  FD_SET(socket, &fdset);
+  timeout.tv_sec = 5;
+  timeout.tv_usec = 0;
+	while (select(1, fdset, NULL, NULL, &timeout) > 0)
+  {
+    if (recv(socket, pch, 1, 0) == 1)
+    {
+      pch++;
+      length++;
+      if (WasErrorReportDelivered(responseBuffer))
+      {
+        *responseBufferSize = length;
+        return TRUE;
+      }
+    }
+    else
+      break;
+  }
+  *responseBufferSize = 0;
+  return FALSE;
+}
+
+BOOL
+SubmitErrorReport(SOCKET socket, LPERROR_REPORT errorReport)
+{
+  BOOL wasErrorReportDelivered;
+  LPSTR requestBuffer;
+  LPSTR responseBuffer;
+  ULONG requestBufferSize = MAX_REQUEST_BUFFER_SIZE;
+
+  requestBuffer = malloc(requestBufferSize);
+  memset(requestBuffer, '\0', requestBufferSize);
+  CreateHTTPPostRequest(requestBuffer, ErrorReportingServerName, errorReport);
+	send(socket, requestBuffer, strlen(requestBuffer), 0);
+  responseBuffer = malloc(requestBufferSize);
+  wasErrorReportDelivered = ReceiveResponse(socket, responseBuffer, IN OUT &requestBufferSize);
+  free(responseBuffer);
+  free(requestBuffer);
+  return wasErrorReportDelivered;
+}
+
+VOID
+DisconnectFromServer(SOCKET socket)
+{
+  closesocket(socket);
+}
+
+DWORD STDCALL
+SubmissionThread(LPVOID lpParameter)
+{
+  WCHAR errorMessage[1024];
+  SOCKET socket;
+  HANDLE hThread;
+  INT error;
+  INT i;
+
+  if (AbortSubmission != 0)
+    goto done;
+
+  PostMessage(hSubmissionNotifyWnd, WM_CONTACTING_SERVER, IDS_CONTACTING_SERVER, 0);
+
+  error = ConnectToServer(ErrorReportingServerName, &socket, errorMessage);
+  if (error != NO_ERROR)
+  {
+    MessageBox(NULL, errorMessage, NULL, MB_ICONWARNING);
+
+    PostMessage(hSubmissionNotifyWnd, WM_ABORT_SUBMISSION, IDS_FAILED_TO_LOCATE_SERVER, 0);
+    goto cleanup;
+  }
+
+  if (!SubmitErrorReport(socket, ErrorReport))
+  {
+    PostMessage(hSubmissionNotifyWnd, WM_ABORT_SUBMISSION, IDS_FAILED_TO_DELIVER_ERROR_REPORT, 0);
+    goto cleanup;
+  }
+
+  DisconnectFromServer(socket);
+done:
+  switch (AbortSubmission)
+  {
+    case 0:
+      SendMessage(hSubmissionNotifyWnd, WM_SUBMISSION_COMPLETE, 0, 0);
+      break;
+    case 1:
+      SendMessage(hSubmissionNotifyWnd, WM_ABORT_SUBMISSION, 0, 0);
+      break;
+  }
+
+cleanup:
+  hThread = (HANDLE)InterlockedExchange((LONG*)&hSubmissionThread, 0);
+  if (hThread != NULL)
+    CloseHandle(hThread);
+  ReleaseErrorReport(ErrorReport);
+  ErrorReport = NULL;
+  return 0;
+}
+
+BOOL
+StartSubmissionThread(HWND hWndNotify)
+{
+  if (hSubmissionThread == NULL)
+  {
+    DWORD ThreadId;
+    hSubmissionNotifyWnd = hWndNotify;
+    AbortSubmission = 0;
+    hSubmissionThread = CreateThread(NULL,
+                                     0,
+                                     SubmissionThread,
+                                     NULL,
+                                     CREATE_SUSPENDED,
+                                     &ThreadId);
+    if (hSubmissionThread == NULL)
+      return FALSE;
+
+    ResumeThread(hSubmissionThread);
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+INT_PTR CALLBACK
+PageSubmittingReportProc(
+  HWND hwndDlg,
+  UINT uMsg,
+  WPARAM wParam,
+  LPARAM lParam)
+{
+  switch (uMsg)
+  {
+    case WM_NOTIFY:
+    {
+      LPNMHDR pnmh = (LPNMHDR)lParam;
+      switch (pnmh->code)
+      {
+        case PSN_SETACTIVE:
+        {
+          SetDlgItemText(hwndDlg, IDC_SUBMISSION_STATUS, NULL);
+          SendDlgItemMessage(hwndDlg, IDC_SUBMITTING_IN_PROGRESS, PBM_SETMARQUEE, TRUE, 50);
+          PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
+          StartSubmissionThread(hwndDlg);
+          break;
+        }
+        case PSN_RESET:
+        {
+          TerminateSubmission(TRUE);
+          break;
+        }
+        case PSN_WIZBACK:
+          if (hSubmissionThread != NULL)
+          {
+            PropSheet_SetWizButtons(GetParent(hwndDlg), 0);
+            TerminateSubmission(FALSE);
+            SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+            return -1;
+          }
+          else
+          {
+            SendDlgItemMessage(hwndDlg, IDC_SUBMITTING_IN_PROGRESS, PBM_SETMARQUEE, FALSE, 0);
+            SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SUBMIT_REPORT);
+          }
+          break;
+      }
+      break;
+    }
+    case WM_CONTACTING_SERVER:
+    {
+      WCHAR Msg[1024];
+      LoadString(hAppInstance, wParam, Msg, sizeof(Msg) / sizeof(WCHAR));
+      SetDlgItemText(hwndDlg, IDC_SUBMISSION_STATUS, Msg);
+      break;
+    }
+    case WM_SUBMISSION_COMPLETE:
+    {
+      SendDlgItemMessage(hwndDlg, IDC_SUBMITTING_IN_PROGRESS, PBM_SETMARQUEE, FALSE, 0);
+      PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
+      PropSheet_SetCurSelByID(GetParent(hwndDlg), IDD_SUBMITTED_REPORT);
+      break;
+    }
+    case WM_ABORT_SUBMISSION:
+    {
+      /* Go back in case we aborted the submission thread */
+      SendDlgItemMessage(hwndDlg, IDC_SUBMITTING_IN_PROGRESS, PBM_SETMARQUEE, FALSE, 0);
+        PropSheet_SetCurSelByID(GetParent(hwndDlg), IDD_SUBMIT_REPORT);
+      if (wParam != 0)
+      {
+        WCHAR Msg[1024];
+        LoadString(hAppInstance, wParam, Msg, sizeof(Msg) / sizeof(WCHAR));
+        MessageBox(GetParent(hwndDlg), Msg, NULL, MB_ICONWARNING);
+      }
+      break;
+    }
+  }
+  return FALSE;
+}
+
+INT_PTR CALLBACK
+PageSubmittedReportProc(
+  HWND hwndDlg,
+  UINT uMsg,
+  WPARAM wParam,
+  LPARAM lParam)
+{
+  switch(uMsg)
+  {
+    case WM_NOTIFY:
+    {
+      LPNMHDR pnmh = (LPNMHDR)lParam;
+      switch (pnmh->code)
+      {
+        case PSN_SETACTIVE:
+        {
+          EnableWindow(GetDlgItem(GetParent(hwndDlg), IDCANCEL), FALSE);
+          PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH);
+          break;
+        }
+      }
+      break;
+    }
+  }
+  return FALSE;
+}
+
+static LONG
+CreateWizard(VOID)
+{
+  PROPSHEETPAGE psp[8];
+  PROPSHEETHEADER psh;
+  WCHAR Caption[1024];
+
+  LoadString(hAppInstance, IDS_WIZARD_NAME, Caption, sizeof(Caption) / sizeof(TCHAR));
+
+  ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
+  psh.dwSize = sizeof(PROPSHEETHEADER);
+  psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
+  psh.hwndParent = NULL;
+  psh.hInstance = hAppInstance;
+  psh.hIcon = 0;
+  psh.pszCaption = Caption;
+  psh.nPages = 4;
+  psh.nStartPage = 0;
+  psh.ppsp = psp;
+  psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
+  psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
+
+  InitPropSheetPage(&psp[0], IDD_FIRSTPAGE, PSP_HIDEHEADER, PageFirstPageProc);
+  InitPropSheetPage(&psp[1], IDD_SUBMIT_REPORT, PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE, PageSubmitReportProc);
+  InitPropSheetPage(&psp[2], IDD_SUBMITTING_REPORT, PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE, PageSubmittingReportProc);
+  InitPropSheetPage(&psp[3], IDD_SUBMITTED_REPORT, PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE, PageSubmittedReportProc);
+
+  return (LONG)(PropertySheet(&psh) != -1);
+}
+
+int WINAPI 
+WinMain(HINSTANCE hInstance,
+	HINSTANCE hPrevInstance,
+	LPSTR lpszCmdLine,
+	int nCmdShow)
+{
+	WORD wVersionRequested;
+	WSADATA wsaData;
+	INT error;
+  INT version;
+  WCHAR *lc;
+
+  hAppInstance = hInstance;
+
+  wVersionRequested = MAKEWORD(1, 1);
+  error = WSAStartup(wVersionRequested, &wsaData);
+  if (error != NO_ERROR)
+  {
+    WCHAR format[1024];
+    WCHAR message[1024];
+    LoadString(hAppInstance, IDS_FAILED_TO_INITIALIZE_WINSOCK, format, sizeof(format) / sizeof(WCHAR));
+    wsprintf(message, format, error);
+    MessageBox(NULL, message, NULL, MB_ICONWARNING);
+    return;
+  }
+  
+  CreateWizard();
+
+ 	WSACleanup();
+  
+  return 0;
+}

Added: trunk/reactos/subsys/system/reporterror/reporterror.h
--- trunk/reactos/subsys/system/reporterror/reporterror.h	2005-01-01 01:03:31 UTC (rev 12673)
+++ trunk/reactos/subsys/system/reporterror/reporterror.h	2005-01-01 01:11:54 UTC (rev 12674)
@@ -0,0 +1,50 @@
+#ifndef __REPORTERROR_H
+#define __REPORTERROR_H
+
+#ifndef PSCB_BUTTONPRESSED
+#define PSCB_BUTTONPRESSED	(3)
+#endif
+
+#ifndef PBS_MARQUEE
+#define PBS_MARQUEE	(8)
+#endif
+
+/* metrics */
+#define PROPSHEETWIDTH 250
+#define PROPSHEETHEIGHT 120
+#define PROPSHEETPADDING 6
+#define SYSTEM_COLUMN (18 * PROPSHEETPADDING)
+#define LABELLINE(x) (((PROPSHEETPADDING + 2) * x) + (x + 2))
+#define ICONSIZE 16
+
+/* Resource IDs */
+
+#define IDS_WIZARD_NAME 100
+#define IDS_FAILED_TO_CONTACT_SERVER 101
+
+#define IDS_CONTACTING_SERVER	201
+#define IDS_FAILED_TO_INITIALIZE_WINSOCK 202
+#define IDS_FAILED_TO_LOCATE_SERVER	203
+#define IDS_FAILED_TO_DELIVER_ERROR_REPORT 204
+
+#define IDD_FIRSTPAGE 100
+#define IDD_SUBMIT_REPORT 101
+#define IDD_SUBMITTING_REPORT 102
+#define IDD_SUBMITTED_REPORT 103
+
+#define IDC_SUBMISSION_STATUS 200
+#define IDC_SUBMITTING_IN_PROGRESS 201
+
+#define IDE_SUBMIT_REPORT_YOUR_EMAIL 300
+#define IDE_SUBMIT_REPORT_PROBLEM_DESCRIPTION 301
+
+#define IDB_WATERMARK 100
+#define IDB_HEADER 101
+
+typedef struct _ERROR_REPORT
+{
+  LPSTR YourEmail;
+  LPSTR ProblemDescription;
+} ERROR_REPORT, *LPERROR_REPORT;
+
+#endif /* __REPORTERROR_H */

Added: trunk/reactos/subsys/system/reporterror/reporterror.rc
--- trunk/reactos/subsys/system/reporterror/reporterror.rc	2005-01-01 01:03:31 UTC (rev 12673)
+++ trunk/reactos/subsys/system/reporterror/reporterror.rc	2005-01-01 01:11:54 UTC (rev 12674)
@@ -0,0 +1,17 @@
+#include <defines.h>
+#include "reporterror.h"
+
+#define REACTOS_STR_FILE_DESCRIPTION	"ReactOS Error Reporting Assistant\0"
+#define REACTOS_STR_INTERNAL_NAME	"reporterror\0"
+#define REACTOS_STR_ORIGINAL_FILENAME	"reporterror.exe\0"
+#include <reactos/version.rc>
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+1 24 DISCARDABLE "manifest.xml"
+
+/* Bitmaps */
+IDB_WATERMARK BITMAP "resources/watermark.bmp"
+IDB_HEADER    BITMAP "resources/header.bmp"
+
+#include "En.rc"

Added: trunk/reactos/subsys/system/reporterror/resources/header.bmp
(Binary files differ)
Property changes on: trunk/reactos/subsys/system/reporterror/resources/header.bmp
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/reactos/subsys/system/reporterror/resources/watermark.bmp
(Binary files differ)
Property changes on: trunk/reactos/subsys/system/reporterror/resources/watermark.bmp
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream