Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More bad line breaks.

  • Loading branch information...
commit f8cc93544fe7088a09dff371b8256d1e915f138d 1 parent b24b237
@calebegg authored
View
428 ctrl-c/ctrlc-windows/ctrlc-windows.cpp
@@ -1,214 +1,214 @@
-// CtrlCWrapper.cpp : Defines the entry point for the console application.
-//
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <io.h>
-#include <Windows.h>
-#include <string>
-#include <iostream>
-
-unsigned int edibleCtrlCs = 0;
-
-DWORD WINAPI MonitorProcessCloseThread(LPVOID processParam)
-{
- HANDLE process = (HANDLE)processParam;
- ::WaitForSingleObject(process, INFINITE);
- CloseHandle(GetStdHandle(STD_INPUT_HANDLE));
-
- return 0;
-}
-
-BOOL MonitorProcessClose(HANDLE process)
-{
- if (!process) return FALSE;
-
- HANDLE thread = ::CreateThread(NULL, 0, MonitorProcessCloseThread, process, 0, 0);
-
- return thread!=NULL;
-}
-
-
-BOOL CreatePipes(HANDLE * readPipe, HANDLE * writePipe)
-{
- SECURITY_ATTRIBUTES saAttr;
- ZeroMemory(&saAttr, sizeof(SECURITY_ATTRIBUTES));
- saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
- saAttr.bInheritHandle = TRUE;
- saAttr.lpSecurityDescriptor = NULL;
-
- // Create a pipe for the child process's STDOUT.
- if ( !CreatePipe(readPipe, writePipe, &saAttr, 0) ) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-BOOL SendFully(HANDLE sink, char *buffer, DWORD count)
-{
- DWORD sent = 0;
- while (sent < count) {
- DWORD dwWritten = 0;
- if (!WriteFile(sink, buffer + sent, count - sent, &dwWritten, NULL)) return FALSE;
- sent += dwWritten;
- }
- return TRUE;
-}
-
-BOOL ProcessExited(HANDLE process)
-{
- DWORD exitCode;
- if (!GetExitCodeProcess(process, &exitCode)) return TRUE;
-
- return exitCode != STILL_ACTIVE;
-}
-
-#define TERMINATE_SIGNAL 0
-#define CTRL_C_SIGNAL 1
-
-BOOL WriteToPipe(HANDLE sink, HANDLE process)
-{
- char buffer[1024];
-
- HANDLE myStdIn = GetStdHandle(STD_INPUT_HANDLE);
- DWORD numberOfBytesRead = 0;
-
- while (true) {
-
- if (!ReadFile(myStdIn, &buffer, sizeof(buffer), &numberOfBytesRead, NULL)) {
- if (ProcessExited(process)) return TRUE;
- return FALSE;
- }
-
- DWORD sendStart = 0;
- DWORD sendEnd = 0;
-
- while (sendStart < numberOfBytesRead) {
- while (sendEnd < numberOfBytesRead && buffer[sendEnd]!=CTRL_C_SIGNAL && buffer[sendEnd]!=TERMINATE_SIGNAL) {
- sendEnd++;
- }
-
- if (!SendFully(sink, buffer + sendStart, sendEnd - sendStart)) return FALSE;
-
- if (sendEnd < numberOfBytesRead) {
- if (buffer[sendEnd] == TERMINATE_SIGNAL) {
- TerminateProcess(process, 0);
- return TRUE;
- } else if (buffer[sendEnd] == CTRL_C_SIGNAL) {
- // That means we hit a 0!
- edibleCtrlCs++;
- GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
- }
- }
- sendStart = sendEnd + 1;
- }
- }
-}
-
-
-BOOL Go(const char *commandLine)
-{
- HANDLE stdInRead, stdInWrite;
-
- if (!CreatePipes(&stdInRead, &stdInWrite)) return FALSE;
-
-
- PROCESS_INFORMATION piProcInfo;
- STARTUPINFO siStartInfo;
- BOOL bSuccess = FALSE;
-
-
- ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION) );
-
- ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) );
- siStartInfo.cb = sizeof(STARTUPINFO);
- siStartInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
- siStartInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- siStartInfo.hStdInput = stdInRead;
- siStartInfo.dwFlags |= STARTF_USESTDHANDLES;
-
- siStartInfo.wShowWindow = SW_HIDE;
- siStartInfo.dwFlags |= STARTF_USESHOWWINDOW;
- // Create the child process.
-
- if (!CreateProcess(NULL,
- const_cast<char *>(commandLine), // command line
- NULL, // process security attributes
- NULL, // primary thread security attributes
- TRUE, // handles are inherited
- CREATE_BREAKAWAY_FROM_JOB, // creation flags
- NULL, // use parent's environment
- NULL, // use parent's current directory
- &siStartInfo, // STARTUPINFO pointer
- &piProcInfo)) // receives PROCESS_INFORMATION
- {
- return FALSE;
- }
-
- HANDLE ghJob = CreateJobObject( NULL, NULL);
-
- JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = { 0 };
- jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
- if( ghJob == NULL || SetInformationJobObject( ghJob, JobObjectExtendedLimitInformation, &jeli, sizeof(jeli)) == FALSE) {
- std::cerr << "Error initializing close-process job";
- return 1;
- }
-
- if (!AssignProcessToJobObject( ghJob, piProcInfo.hProcess)) {
- DWORD error = GetLastError();
- std::cerr << "AssignProcessToJobObject failed: " << error << std::endl;
- return FALSE;
- }
-
- // Close handles to the child process and its primary thread.
- // Some applications might keep these handles to monitor the status
- // of the child process, for example.
-
- CloseHandle(piProcInfo.hThread);
- MonitorProcessClose(piProcInfo.hProcess);
-
- WriteToPipe(stdInWrite, piProcInfo.hProcess);
-
- CloseHandle(piProcInfo.hProcess);
- CloseHandle(stdInRead);
- CloseHandle(stdInWrite);
-
-
- return 0;
-}
-
-
-BOOL CleanUpHandle(HANDLE & pipe)
-{
- if (pipe)
- {
- BOOL success = CloseHandle(pipe);
- pipe = NULL;
- return success;
- }
- return TRUE;
-}
-
-BOOL WINAPI HandlerRoutine(__in DWORD dwCtrlType)
-{
- if (edibleCtrlCs == 0 || dwCtrlType != CTRL_C_EVENT) return FALSE;
-
- edibleCtrlCs--;
- return TRUE;
-}
-
-int main(int argc, char* argv[])
-{
- SetConsoleCtrlHandler(HandlerRoutine, TRUE);
- _setmode(_fileno(stdout), O_BINARY);
- _setmode(_fileno(stdin), O_BINARY);
-
- std::string args;
- for (int arg = 1; arg < argc; arg++) {
- if (arg > 1) args += " ";
- args += argv[arg];
- }
-
- return Go(args.c_str()) ? 0 : 1;
-}
+// CtrlCWrapper.cpp : Defines the entry point for the console application.
+//
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <io.h>
+#include <Windows.h>
+#include <string>
+#include <iostream>
+
+unsigned int edibleCtrlCs = 0;
+
+DWORD WINAPI MonitorProcessCloseThread(LPVOID processParam)
+{
+ HANDLE process = (HANDLE)processParam;
+ ::WaitForSingleObject(process, INFINITE);
+ CloseHandle(GetStdHandle(STD_INPUT_HANDLE));
+
+ return 0;
+}
+
+BOOL MonitorProcessClose(HANDLE process)
+{
+ if (!process) return FALSE;
+
+ HANDLE thread = ::CreateThread(NULL, 0, MonitorProcessCloseThread, process, 0, 0);
+
+ return thread!=NULL;
+}
+
+
+BOOL CreatePipes(HANDLE * readPipe, HANDLE * writePipe)
+{
+ SECURITY_ATTRIBUTES saAttr;
+ ZeroMemory(&saAttr, sizeof(SECURITY_ATTRIBUTES));
+ saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
+ saAttr.bInheritHandle = TRUE;
+ saAttr.lpSecurityDescriptor = NULL;
+
+ // Create a pipe for the child process's STDOUT.
+ if ( !CreatePipe(readPipe, writePipe, &saAttr, 0) ) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+BOOL SendFully(HANDLE sink, char *buffer, DWORD count)
+{
+ DWORD sent = 0;
+ while (sent < count) {
+ DWORD dwWritten = 0;
+ if (!WriteFile(sink, buffer + sent, count - sent, &dwWritten, NULL)) return FALSE;
+ sent += dwWritten;
+ }
+ return TRUE;
+}
+
+BOOL ProcessExited(HANDLE process)
+{
+ DWORD exitCode;
+ if (!GetExitCodeProcess(process, &exitCode)) return TRUE;
+
+ return exitCode != STILL_ACTIVE;
+}
+
+#define TERMINATE_SIGNAL 0
+#define CTRL_C_SIGNAL 1
+
+BOOL WriteToPipe(HANDLE sink, HANDLE process)
+{
+ char buffer[1024];
+
+ HANDLE myStdIn = GetStdHandle(STD_INPUT_HANDLE);
+ DWORD numberOfBytesRead = 0;
+
+ while (true) {
+
+ if (!ReadFile(myStdIn, &buffer, sizeof(buffer), &numberOfBytesRead, NULL)) {
+ if (ProcessExited(process)) return TRUE;
+ return FALSE;
+ }
+
+ DWORD sendStart = 0;
+ DWORD sendEnd = 0;
+
+ while (sendStart < numberOfBytesRead) {
+ while (sendEnd < numberOfBytesRead && buffer[sendEnd]!=CTRL_C_SIGNAL && buffer[sendEnd]!=TERMINATE_SIGNAL) {
+ sendEnd++;
+ }
+
+ if (!SendFully(sink, buffer + sendStart, sendEnd - sendStart)) return FALSE;
+
+ if (sendEnd < numberOfBytesRead) {
+ if (buffer[sendEnd] == TERMINATE_SIGNAL) {
+ TerminateProcess(process, 0);
+ return TRUE;
+ } else if (buffer[sendEnd] == CTRL_C_SIGNAL) {
+ // That means we hit a 0!
+ edibleCtrlCs++;
+ GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
+ }
+ }
+ sendStart = sendEnd + 1;
+ }
+ }
+}
+
+
+BOOL Go(const char *commandLine)
+{
+ HANDLE stdInRead, stdInWrite;
+
+ if (!CreatePipes(&stdInRead, &stdInWrite)) return FALSE;
+
+
+ PROCESS_INFORMATION piProcInfo;
+ STARTUPINFO siStartInfo;
+ BOOL bSuccess = FALSE;
+
+
+ ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION) );
+
+ ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) );
+ siStartInfo.cb = sizeof(STARTUPINFO);
+ siStartInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
+ siStartInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
+ siStartInfo.hStdInput = stdInRead;
+ siStartInfo.dwFlags |= STARTF_USESTDHANDLES;
+
+ siStartInfo.wShowWindow = SW_HIDE;
+ siStartInfo.dwFlags |= STARTF_USESHOWWINDOW;
+ // Create the child process.
+
+ if (!CreateProcess(NULL,
+ const_cast<char *>(commandLine), // command line
+ NULL, // process security attributes
+ NULL, // primary thread security attributes
+ TRUE, // handles are inherited
+ CREATE_BREAKAWAY_FROM_JOB, // creation flags
+ NULL, // use parent's environment
+ NULL, // use parent's current directory
+ &siStartInfo, // STARTUPINFO pointer
+ &piProcInfo)) // receives PROCESS_INFORMATION
+ {
+ return FALSE;
+ }
+
+ HANDLE ghJob = CreateJobObject( NULL, NULL);
+
+ JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = { 0 };
+ jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
+ if( ghJob == NULL || SetInformationJobObject( ghJob, JobObjectExtendedLimitInformation, &jeli, sizeof(jeli)) == FALSE) {
+ std::cerr << "Error initializing close-process job";
+ return 1;
+ }
+
+ if (!AssignProcessToJobObject( ghJob, piProcInfo.hProcess)) {
+ DWORD error = GetLastError();
+ std::cerr << "AssignProcessToJobObject failed: " << error << std::endl;
+ return FALSE;
+ }
+
+ // Close handles to the child process and its primary thread.
+ // Some applications might keep these handles to monitor the status
+ // of the child process, for example.
+
+ CloseHandle(piProcInfo.hThread);
+ MonitorProcessClose(piProcInfo.hProcess);
+
+ WriteToPipe(stdInWrite, piProcInfo.hProcess);
+
+ CloseHandle(piProcInfo.hProcess);
+ CloseHandle(stdInRead);
+ CloseHandle(stdInWrite);
+
+
+ return 0;
+}
+
+
+BOOL CleanUpHandle(HANDLE & pipe)
+{
+ if (pipe)
+ {
+ BOOL success = CloseHandle(pipe);
+ pipe = NULL;
+ return success;
+ }
+ return TRUE;
+}
+
+BOOL WINAPI HandlerRoutine(__in DWORD dwCtrlType)
+{
+ if (edibleCtrlCs == 0 || dwCtrlType != CTRL_C_EVENT) return FALSE;
+
+ edibleCtrlCs--;
+ return TRUE;
+}
+
+int main(int argc, char* argv[])
+{
+ SetConsoleCtrlHandler(HandlerRoutine, TRUE);
+ _setmode(_fileno(stdout), O_BINARY);
+ _setmode(_fileno(stdin), O_BINARY);
+
+ std::string args;
+ for (int arg = 1; arg < argc; arg++) {
+ if (arg > 1) args += " ";
+ args += argv[arg];
+ }
+
+ return Go(args.c_str()) ? 0 : 1;
+}
View
40 ctrl-c/ctrlc-windows/ctrlc-windows.sln
@@ -1,20 +1,20 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ctrlc-windows", "ctrlc-windows.vcxproj", "{FE2D04A6-A45D-461A-BE54-FD7791E39E5B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {FE2D04A6-A45D-461A-BE54-FD7791E39E5B}.Debug|Win32.ActiveCfg = Debug|Win32
- {FE2D04A6-A45D-461A-BE54-FD7791E39E5B}.Debug|Win32.Build.0 = Debug|Win32
- {FE2D04A6-A45D-461A-BE54-FD7791E39E5B}.Release|Win32.ActiveCfg = Release|Win32
- {FE2D04A6-A45D-461A-BE54-FD7791E39E5B}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ctrlc-windows", "ctrlc-windows.vcxproj", "{FE2D04A6-A45D-461A-BE54-FD7791E39E5B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FE2D04A6-A45D-461A-BE54-FD7791E39E5B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FE2D04A6-A45D-461A-BE54-FD7791E39E5B}.Debug|Win32.Build.0 = Debug|Win32
+ {FE2D04A6-A45D-461A-BE54-FD7791E39E5B}.Release|Win32.ActiveCfg = Release|Win32
+ {FE2D04A6-A45D-461A-BE54-FD7791E39E5B}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
168 ctrl-c/ctrlc-windows/ctrlc-windows.vcxproj
@@ -1,85 +1,85 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{FE2D04A6-A45D-461A-BE54-FD7791E39E5B}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>ctrlcwindows</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <CharacterSet>NotSet</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>NotSet</CharacterSet>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>true</LinkIncremental>
- <OutDir>$(SolutionDir)..\..\</OutDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="ctrlc-windows.cpp" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{FE2D04A6-A45D-461A-BE54-FD7791E39E5B}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>ctrlcwindows</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>NotSet</CharacterSet>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>NotSet</CharacterSet>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(SolutionDir)..\..\</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="ctrlc-windows.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
</Project>
View
2  dracula/defrandom.lisp
@@ -6,7 +6,7 @@
(defmacro% %scramble-step (n magic op1 op2 shift)
`(logand #xffffffff (,op2 (,op1 ,n ,magic) (ash ,n ,shift))))
-
+
;; Robert Jenkins' 32 bit integer hash function. http://www.concentric.net/~ttwang/tech/inthash.htm
(defun% %scramble (n)
(let* ((n (%scramble-step n #x7ed55d16 + + 12))
View
468 dracula/doublecheck.lisp
@@ -1,235 +1,235 @@
-(in-package "ACL2")
-
-(set-state-ok t)
-
-(defconst *default-repeat* 50)
-(defconst *default-limit* 60)
-
-(defun random-between-fn (low high state)
- (mv-let (random state)
- (random$ (- high low) state)
- (mv (+ random low) state)))
-
-(defmacro random-between (low high)
- `(random-between-fn ,low ,high state))
-
-(defabbrev random-natural ()
- (random-between 0 10000))
-
-(defabbrev random-positive ()
- (random-between 1 10000))
-
-(defabbrev random-integer ()
- (random-between -10000 10000))
-
-(defmacro random-rational ()
- `(mv-let (a state)
- (random-integer)
- (mv-let (b state)
- (random-integer)
- (mv (/ a b) state))))
-
-(defmacro random-complex ()
- `(mv-let (a state)
- (random-rational)
- (mv-let (b state)
- (random-rational)
- (mv (complex a b) state))))
-
-(defabbrev random-data-size ()
- (random-between 0 15))
-
-(defmacro random-number ()
- `(mv-let (which state)
- (random-between 0 3)
- (cond ((= which 0)
- (random-integer))
- ((= which 1)
- (random-rational))
- (t
- (random-complex)))))
-
-(defun random-integer-list-of-length-fn (n state)
- (if (zp n)
- (mv nil state)
- (mv-let (xs state)
- (random-integer-list-of-length-fn (1- n) state)
- (mv-let (val state)
- (random-integer)
- (mv (cons val xs) state)))))
-
-(defmacro random-integer-list ()
- `(mv-let (ln state)
- (random-data-size)
- (random-integer-list-of-length-fn ln state)))
-
-(defun random-digit-list-of-length-fn (n state)
- (if (zp n)
- (mv nil state)
- (mv-let (xs state)
- (random-digit-list-of-length-fn (1- n) state)
- (mv-let (val state)
- (random-between 0 9)
- (mv (cons val xs) state)))))
-
-(defmacro random-digit-list ()
- `(mv-let (ln state)
- (random-data-size)
- (random-digit-list-of-length-fn ln state)))
-
-(defun random-between-list-fn (lo hi ln state)
- (if (zp ln)
- (mv nil state)
- (mv-let (xs state)
- (random-between-list-fn lo hi (1- ln) state)
- (mv-let (rnd state)
- (random-between lo hi)
- (mv (cons rnd xs) state)))))
-
-(defmacro random-between-list (lo hi)
- `(mv-let (ln state)
- (random-data-size)
- (random-between-list-fn ,lo ,hi ln state)))
-
-(defun random-increasing-list-fn (ln state)
- (if (zp ln)
- (mv nil state)
- (mv-let (xs state)
- (random-increasing-list-fn (1- ln) state)
- (mv-let (rnd state)
- (let ((prev (if (consp xs)
- (first (last xs))
- 0)))
- (random-between prev (+ 50 prev)))
- (mv (append xs (list rnd)) state)))))
-
-(defmacro random-increasing-list ()
- `(mv-let (ln state)
- (random-data-size)
- (random-increasing-list-fn ln state)))
-
-(defmacro repeat-times (times limit body)
- (if (zp limit)
- `(mv state (hard-error nil
- "Wasn't able to generate enough data. Check your :where clauses (make sure they are satisfiable) and try increasing the :limit for the property"
- nil))
- `(if (zp ,times)
- (mv state nil)
- (mv-let (state result assignments)
- ,body
- (mv-let (state rs)
- (repeat-times (- ,times
- (if (eql result
- 'where-not-matched) 0 1))
- ,(- limit 1) ,body)
- (mv state
- (cons (cons result assignments)
- rs)))))))
-
-(defmacro expand-vars (vars body)
- (if (endp vars)
- `(mv state ,body nil)
- `(mv-let (,(first vars) state)
- ,(cond ((eql (second vars) ':value)
- (third vars))
- ((eql (fourth vars) ':value)
- (fifth vars))
- (t (hard-error
- nil
- "Missing :value parameter for ~xn"
- (list (cons #\n (first vars))))))
- (if ,(cond ((eql (second vars) ':where)
- (third vars))
- ((eql (fourth vars) ':where)
- (fifth vars))
- (t t))
- (mv-let (state result assignments)
- (expand-vars ,(cond ((member (fourth vars)
- '(:value :where))
- (nthcdr 5 vars))
- (t (nthcdr 3 vars)))
- ,body)
- (mv state result
- (cons (cons (quote ,(first vars))
- ,(first vars))
- assignments)))
- (mv state 'where-not-matched nil)))))
-
-(defun eager-and (x y)
- (and x y))
-
-(defun condense-results (rs)
- (if (endp rs)
- t
- (eager-and (let ((success (first (first rs))))
- (prog2$
- (if (not success)
- (cw "Failed with assignments: ~&0~%" (rest (first rs)))
- (cw "Succeeded with assignments: ~&0~%" (rest (first rs))))
- success))
- (condense-results (rest rs)))))
-
-(defmacro defproperty-program (name &rest args)
- (let ((repeat (cond ((eql (first args) ':repeat)
- (second args))
- ((eql (third args) ':repeat)
- (fourth args))
- (t *default-repeat*)))
- (limit (cond ((eql (first args) ':limit)
- (second args))
- ((eql (third args) ':limit)
- (fourth args))
- (t *default-limit*)))
- (vars (cond ((<= (len args) 3) (first args))
- ((<= (len args) 5) (third args))
- ((<= (len args) 7) (fifth args))))
- (body (cond ((<= (len args) 3) (second args))
- ((<= (len args) 5) (fourth args))
- ((<= (len args) 7) (sixth args)))))
- `(mv-let (state results)
- (repeat-times ,repeat ,limit
- (expand-vars ,vars ,body))
- (if (condense-results results)
- (mv nil nil state)
- (mv (hard-error nil "Test ~xn failed."
- (list (cons #\n (quote ,name))))
- nil
- state)))))
-
-;; Code from Dracula begins here
-(defun expand-defproperty-implication (hyps test)
- `(implies (and ,@hyps) ,test))
-
-(defun expand-defproperty-hypotheses (vars)
- (case-match vars
- ((':where hyp . rest)
- (cons hyp (expand-defproperty-hypotheses rest)))
- ((':value & . rest)
- (expand-defproperty-hypotheses rest))
- ((':limit & . rest)
- (expand-defproperty-hypotheses rest))
- ((& . rest) (expand-defproperty-hypotheses rest))
- (nil nil)))
-
-(defun expand-defproperty-body (body)
- (case-match body
- ((':repeat & . rest) (expand-defproperty-body rest))
- ((':limit & . rest) (expand-defproperty-body rest))
- ((vars test . options)
- (cons
- (expand-defproperty-implication
- (expand-defproperty-hypotheses vars)
- test)
- options))))
-
-(defmacro defproperty-logic (name &rest rest)
- `(defthm ,name ,@(expand-defproperty-body rest)))
-;; Code from Dracula ends here
-
-(defmacro defproperty (name &rest args)
- `(mv-let (er val state)
- (table acl2-defaults-table :defun-mode)
- (declare (ignore er))
- (if (eq val :logic)
- (defproperty-logic ,name ,@args)
+(in-package "ACL2")
+
+(set-state-ok t)
+
+(defconst *default-repeat* 50)
+(defconst *default-limit* 60)
+
+(defun random-between-fn (low high state)
+ (mv-let (random state)
+ (random$ (- high low) state)
+ (mv (+ random low) state)))
+
+(defmacro random-between (low high)
+ `(random-between-fn ,low ,high state))
+
+(defabbrev random-natural ()
+ (random-between 0 10000))
+
+(defabbrev random-positive ()
+ (random-between 1 10000))
+
+(defabbrev random-integer ()
+ (random-between -10000 10000))
+
+(defmacro random-rational ()
+ `(mv-let (a state)
+ (random-integer)
+ (mv-let (b state)
+ (random-integer)
+ (mv (/ a b) state))))
+
+(defmacro random-complex ()
+ `(mv-let (a state)
+ (random-rational)
+ (mv-let (b state)
+ (random-rational)
+ (mv (complex a b) state))))
+
+(defabbrev random-data-size ()
+ (random-between 0 15))
+
+(defmacro random-number ()
+ `(mv-let (which state)
+ (random-between 0 3)
+ (cond ((= which 0)
+ (random-integer))
+ ((= which 1)
+ (random-rational))
+ (t
+ (random-complex)))))
+
+(defun random-integer-list-of-length-fn (n state)
+ (if (zp n)
+ (mv nil state)
+ (mv-let (xs state)
+ (random-integer-list-of-length-fn (1- n) state)
+ (mv-let (val state)
+ (random-integer)
+ (mv (cons val xs) state)))))
+
+(defmacro random-integer-list ()
+ `(mv-let (ln state)
+ (random-data-size)
+ (random-integer-list-of-length-fn ln state)))
+
+(defun random-digit-list-of-length-fn (n state)
+ (if (zp n)
+ (mv nil state)
+ (mv-let (xs state)
+ (random-digit-list-of-length-fn (1- n) state)
+ (mv-let (val state)
+ (random-between 0 9)
+ (mv (cons val xs) state)))))
+
+(defmacro random-digit-list ()
+ `(mv-let (ln state)
+ (random-data-size)
+ (random-digit-list-of-length-fn ln state)))
+
+(defun random-between-list-fn (lo hi ln state)
+ (if (zp ln)
+ (mv nil state)
+ (mv-let (xs state)
+ (random-between-list-fn lo hi (1- ln) state)
+ (mv-let (rnd state)
+ (random-between lo hi)
+ (mv (cons rnd xs) state)))))
+
+(defmacro random-between-list (lo hi)
+ `(mv-let (ln state)
+ (random-data-size)
+ (random-between-list-fn ,lo ,hi ln state)))
+
+(defun random-increasing-list-fn (ln state)
+ (if (zp ln)
+ (mv nil state)
+ (mv-let (xs state)
+ (random-increasing-list-fn (1- ln) state)
+ (mv-let (rnd state)
+ (let ((prev (if (consp xs)
+ (first (last xs))
+ 0)))
+ (random-between prev (+ 50 prev)))
+ (mv (append xs (list rnd)) state)))))
+
+(defmacro random-increasing-list ()
+ `(mv-let (ln state)
+ (random-data-size)
+ (random-increasing-list-fn ln state)))
+
+(defmacro repeat-times (times limit body)
+ (if (zp limit)
+ `(mv state (hard-error nil
+ "Wasn't able to generate enough data. Check your :where clauses (make sure they are satisfiable) and try increasing the :limit for the property"
+ nil))
+ `(if (zp ,times)
+ (mv state nil)
+ (mv-let (state result assignments)
+ ,body
+ (mv-let (state rs)
+ (repeat-times (- ,times
+ (if (eql result
+ 'where-not-matched) 0 1))
+ ,(- limit 1) ,body)
+ (mv state
+ (cons (cons result assignments)
+ rs)))))))
+
+(defmacro expand-vars (vars body)
+ (if (endp vars)
+ `(mv state ,body nil)
+ `(mv-let (,(first vars) state)
+ ,(cond ((eql (second vars) ':value)
+ (third vars))
+ ((eql (fourth vars) ':value)
+ (fifth vars))
+ (t (hard-error
+ nil
+ "Missing :value parameter for ~xn"
+ (list (cons #\n (first vars))))))
+ (if ,(cond ((eql (second vars) ':where)
+ (third vars))
+ ((eql (fourth vars) ':where)
+ (fifth vars))
+ (t t))
+ (mv-let (state result assignments)
+ (expand-vars ,(cond ((member (fourth vars)
+ '(:value :where))
+ (nthcdr 5 vars))
+ (t (nthcdr 3 vars)))
+ ,body)
+ (mv state result
+ (cons (cons (quote ,(first vars))
+ ,(first vars))
+ assignments)))
+ (mv state 'where-not-matched nil)))))
+
+(defun eager-and (x y)
+ (and x y))
+
+(defun condense-results (rs)
+ (if (endp rs)
+ t
+ (eager-and (let ((success (first (first rs))))
+ (prog2$
+ (if (not success)
+ (cw "Failed with assignments: ~&0~%" (rest (first rs)))
+ (cw "Succeeded with assignments: ~&0~%" (rest (first rs))))
+ success))
+ (condense-results (rest rs)))))
+
+(defmacro defproperty-program (name &rest args)
+ (let ((repeat (cond ((eql (first args) ':repeat)
+ (second args))
+ ((eql (third args) ':repeat)
+ (fourth args))
+ (t *default-repeat*)))
+ (limit (cond ((eql (first args) ':limit)
+ (second args))
+ ((eql (third args) ':limit)
+ (fourth args))
+ (t *default-limit*)))
+ (vars (cond ((<= (len args) 3) (first args))
+ ((<= (len args) 5) (third args))
+ ((<= (len args) 7) (fifth args))))
+ (body (cond ((<= (len args) 3) (second args))
+ ((<= (len args) 5) (fourth args))
+ ((<= (len args) 7) (sixth args)))))
+ `(mv-let (state results)
+ (repeat-times ,repeat ,limit
+ (expand-vars ,vars ,body))
+ (if (condense-results results)
+ (mv nil nil state)
+ (mv (hard-error nil "Test ~xn failed."
+ (list (cons #\n (quote ,name))))
+ nil
+ state)))))
+
+;; Code from Dracula begins here
+(defun expand-defproperty-implication (hyps test)
+ `(implies (and ,@hyps) ,test))
+
+(defun expand-defproperty-hypotheses (vars)
+ (case-match vars
+ ((':where hyp . rest)
+ (cons hyp (expand-defproperty-hypotheses rest)))
+ ((':value & . rest)
+ (expand-defproperty-hypotheses rest))
+ ((':limit & . rest)
+ (expand-defproperty-hypotheses rest))
+ ((& . rest) (expand-defproperty-hypotheses rest))
+ (nil nil)))
+
+(defun expand-defproperty-body (body)
+ (case-match body
+ ((':repeat & . rest) (expand-defproperty-body rest))
+ ((':limit & . rest) (expand-defproperty-body rest))
+ ((vars test . options)
+ (cons
+ (expand-defproperty-implication
+ (expand-defproperty-hypotheses vars)
+ test)
+ options))))
+
+(defmacro defproperty-logic (name &rest rest)
+ `(defthm ,name ,@(expand-defproperty-body rest)))
+;; Code from Dracula ends here
+
+(defmacro defproperty (name &rest args)
+ `(mv-let (er val state)
+ (table acl2-defaults-table :defun-mode)
+ (declare (ignore er))
+ (if (eq val :logic)
+ (defproperty-logic ,name ,@args)
(defproperty-program ,name ,@args))))
View
160 installer.nsi
@@ -1,80 +1,80 @@
-!define APPNAME "Proof Pad"
-!define DESCRIPTION "An IDE for ACL2"
-
-!define VERSIONMAJOR 0
-!define VERSIONMINOR 1
-
-RequestExecutionLevel admin
-
-InstallDir "$PROGRAMFILES\${APPNAME}"
-
-Name "${APPNAME}"
-Icon "media\icon.ico"
-outFile "Proof Pad installer.exe"
-
-!include LogicLib.nsh
-
-# Just three pages - license agreement, install location, and installation
-page directory
-Page instfiles
-
-!macro VerifyUserIsAdmin
-UserInfo::GetAccountType
-pop $0
-${If} $0 != "admin"
- messageBox mb_iconstop "Administrator rights required."
- setErrorLevel 740
- quit
-${EndIf}
-!macroend
-
-function .onInit
- setShellVarContext all
- !insertmacro VerifyUserIsAdmin
-functionEnd
-
-section "install"
- setOutPath $INSTDIR
- File "proofpad.jar"
- File "media\icon.ico"
- File /r "acl2"
-
- writeUninstaller "$INSTDIR\uninstall.exe"
-
- # Start Menu
- createDirectory "$SMPROGRAMS"
- createShortCut "$SMPROGRAMS\${APPNAME}.lnk" "$INSTDIR\proofpad.jar" "" "$INSTDIR\icon.ico"
-
- # Registry information for add/remove programs
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME} - ${DESCRIPTION}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\icons.ico$\""
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "$\"Caleb Eggensperger$\""
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "$\"${VERSIONMAJOR}.${VERSIONMINOR}$\""
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "VersionMinor" ${VERSIONMINOR}
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1
-sectionEnd
-
-# Uninstaller
-
-function un.onInit
- SetShellVarContext all
- !insertmacro VerifyUserIsAdmin
-functionEnd
-
-section "uninstall"
- delete "$SMPROGRAMS\${APPNAME}.lnk"
-
-# Delete $INSTDIR\launcher.exe
-# Delete $INSTDIR\proofpad.jar
-# RMDir /r $INSTDIR\acl2
-# delete $INSTDIR\uninstall.exe
- RMDir /r $INSTDIR
-
- # Remove uninstaller information from the registry
- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
-sectionEnd
+!define APPNAME "Proof Pad"
+!define DESCRIPTION "An IDE for ACL2"
+
+!define VERSIONMAJOR 0
+!define VERSIONMINOR 1
+
+RequestExecutionLevel admin
+
+InstallDir "$PROGRAMFILES\${APPNAME}"
+
+Name "${APPNAME}"
+Icon "media\icon.ico"
+outFile "Proof Pad installer.exe"
+
+!include LogicLib.nsh
+
+# Just three pages - license agreement, install location, and installation
+page directory
+Page instfiles
+
+!macro VerifyUserIsAdmin
+UserInfo::GetAccountType
+pop $0
+${If} $0 != "admin"
+ messageBox mb_iconstop "Administrator rights required."
+ setErrorLevel 740
+ quit
+${EndIf}
+!macroend
+
+function .onInit
+ setShellVarContext all
+ !insertmacro VerifyUserIsAdmin
+functionEnd
+
+section "install"
+ setOutPath $INSTDIR
+ File "proofpad.jar"
+ File "media\icon.ico"
+ File /r "acl2"
+
+ writeUninstaller "$INSTDIR\uninstall.exe"
+
+ # Start Menu
+ createDirectory "$SMPROGRAMS"
+ createShortCut "$SMPROGRAMS\${APPNAME}.lnk" "$INSTDIR\proofpad.jar" "" "$INSTDIR\icon.ico"
+
+ # Registry information for add/remove programs
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME} - ${DESCRIPTION}"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\icons.ico$\""
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "$\"Caleb Eggensperger$\""
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "$\"${VERSIONMAJOR}.${VERSIONMINOR}$\""
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "VersionMinor" ${VERSIONMINOR}
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1
+sectionEnd
+
+# Uninstaller
+
+function un.onInit
+ SetShellVarContext all
+ !insertmacro VerifyUserIsAdmin
+functionEnd
+
+section "uninstall"
+ delete "$SMPROGRAMS\${APPNAME}.lnk"
+
+# Delete $INSTDIR\launcher.exe
+# Delete $INSTDIR\proofpad.jar
+# RMDir /r $INSTDIR\acl2
+# delete $INSTDIR\uninstall.exe
+ RMDir /r $INSTDIR
+
+ # Remove uninstaller information from the registry
+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
+sectionEnd
Please sign in to comment.
Something went wrong with that request. Please try again.