git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@18049 ebf7c1c2-ba36-0410-9fe8-c592906822b4

This commit is contained in:
coalado 2012-07-25 15:50:49 +00:00
parent d478e2b735
commit bd41b06475
18 changed files with 837 additions and 9 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,6 @@
Elevate.exe is Released under MIT License:
http://jpassing.com/2007/12/08/launch-elevated-processes-from-the-command-line/
http://opensource.org/licenses/mit-license.php

View File

@ -28,7 +28,6 @@ import org.appwork.storage.jackson.JacksonMapper;
import org.appwork.txtresource.TranslationFactory;
import org.appwork.utils.IO;
import org.appwork.utils.IOErrorHandler;
import org.appwork.utils.logging2.LogSource;
import org.appwork.utils.os.CrossSystem;
import org.appwork.utils.swing.dialog.Dialog;
import org.jdownloader.logging.LogController;
@ -39,17 +38,16 @@ public class Main {
org.appwork.utils.Application.setApplication(".jd_home");
org.appwork.utils.Application.getRoot(jd.Launcher.class);
IO.setErrorHandler(new IOErrorHandler() {
private boolean reported;
private LogSource logger;
private boolean reported;
{
reported = false;
logger = LogController.getInstance().getLogger("GlobalIOErrors");
}
@Override
public void onWriteException(final Throwable e, final File file, final byte[] data) {
logger.log(e);
LogController.getInstance().getLogger("GlobalIOErrors").log(e);
if (reported) return;
reported = true;
new Thread() {
@ -69,7 +67,7 @@ public class Main {
@Override
public void onReadStreamException(final Throwable e, final java.io.InputStream fis) {
logger.log(e);
LogController.getInstance().getLogger("GlobalIOErrors").log(e);
if (reported) return;
reported = true;
new Thread() {
@ -114,7 +112,7 @@ public class Main {
try {
// USe Jacksonmapper in this project
JSonStorage.setMapper(new JacksonMapper());
/* FAKE Commit for coalado */
checkLanguageSwitch(args);
try {
/* set D3D Property if not already set by user */

View File

@ -18,7 +18,10 @@ package org.jdownloader.extensions.shutdown;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenuItem;
@ -34,6 +37,7 @@ import jd.utils.JDUtilities;
import org.appwork.controlling.StateEvent;
import org.appwork.controlling.StateEventListener;
import org.appwork.utils.Application;
import org.appwork.utils.IO;
import org.appwork.utils.logging2.LogSource;
import org.appwork.utils.os.CrossSystem;
@ -258,6 +262,38 @@ public class ShutdownExtension extends AbstractExtension<ShutdownConfig, Shutdow
}
}
public static void main(String[] args) {
System.out.println(CrossSystem.is64Bit());
// try {
// JDUtilities.runCommand("RUNDLL32.EXE", new String[] { "powrprof.dll,SetSuspendState" }, null, 0);
// } catch (Exception e) {
// // try {
// // JDUtilities.runCommand("%windir%\\system32\\RUNDLL32.EXE", new String[] { "powrprof.dll,SetSuspendState" }, null, 0);
// // } catch (Exception ex) {
// // }
// }
String path = CrossSystem.is64Bit() ? Application.getResource("tools\\Windows\\elevate\\Elevate64.exe").getAbsolutePath() : Application.getResource("tools\\Windows\\elevate\\Elevate32.exe").getAbsolutePath();
try {
execute(new String[] { path, "powercfg", "-hibernate", "off" });
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
protected static void execute(String[] command) throws IOException, UnsupportedEncodingException, InterruptedException {
ProcessBuilder probuilder = new ProcessBuilder(command);
Process process = probuilder.start();
System.out.println(Arrays.toString(command));
System.out.println(IO.readInputStreamToString(process.getInputStream()));
System.out.println(IO.readInputStreamToString(process.getErrorStream()));
System.out.println(process.waitFor());
}
private void standby() {
switch (CrossSystem.getID()) {
case CrossSystem.OS_WINDOWS_2003:

View File

@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import jd.Launcher;
import jd.controlling.downloadcontroller.SingleDownloadController;
import jd.controlling.linkchecker.LinkCheckerThread;
import jd.controlling.linkcrawler.LinkCrawlerThread;
@ -50,7 +49,7 @@ public class LogController extends LogSourceProvider {
}
private LogController() {
super(Launcher.startup);
super(System.currentTimeMillis());
}
public static LogSource CL(Class<?> clazz) {

26
tools/Elevate/Elevate.sln Normal file
View File

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Elevate", "Elevate\Elevate.vcproj", "{D44F41E2-0CEE-4B9B-825D-1AEBF6DCAB1C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D44F41E2-0CEE-4B9B-825D-1AEBF6DCAB1C}.Debug|x64.ActiveCfg = Debug|x64
{D44F41E2-0CEE-4B9B-825D-1AEBF6DCAB1C}.Debug|x64.Build.0 = Debug|x64
{D44F41E2-0CEE-4B9B-825D-1AEBF6DCAB1C}.Debug|x86.ActiveCfg = Debug|Win32
{D44F41E2-0CEE-4B9B-825D-1AEBF6DCAB1C}.Debug|x86.Build.0 = Debug|Win32
{D44F41E2-0CEE-4B9B-825D-1AEBF6DCAB1C}.Release|x64.ActiveCfg = Release|x64
{D44F41E2-0CEE-4B9B-825D-1AEBF6DCAB1C}.Release|x64.Build.0 = Release|x64
{D44F41E2-0CEE-4B9B-825D-1AEBF6DCAB1C}.Release|x86.ActiveCfg = Release|Win32
{D44F41E2-0CEE-4B9B-825D-1AEBF6DCAB1C}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@ -0,0 +1,103 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,2894
PRODUCTVERSION 1,0,0,2894
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "Comments", "Tool for elevating applications on the command line"
VALUE "CompanyName", "Johannes Passing"
VALUE "FileDescription", "Elevate"
VALUE "FileVersion", "1, 0, 0, 2894"
VALUE "InternalName", "Elevate"
VALUE "LegalCopyright", "Copyright (C) 2007"
VALUE "OriginalFilename", "Elevate.exe"
VALUE "ProductName", "Elevate Application"
VALUE "ProductVersion", "1, 0, 0, 2894"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END
#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,376 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="Elevate"
ProjectGUID="{D44F41E2-0CEE-4B9B-825D-1AEBF6DCAB1C}"
RootNamespace="Elevate"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)bin\x86\$(ConfigurationName)"
IntermediateDirectory="$(SolutionDir)bin\x86\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
ExceptionHandling="0"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CallingConvention="2"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
ExceptionHandling="0"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
CallingConvention="2"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)bin\x86\$(ConfigurationName)"
IntermediateDirectory="$(SolutionDir)bin\x86\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
ExceptionHandling="0"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
CallingConvention="2"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
ExceptionHandling="0"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
CallingConvention="2"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\resource.h"
>
</File>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\Elevate.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,239 @@
#include "stdafx.h"
/*----------------------------------------------------------------------
* Purpose:
* Execute a process on the command line with elevated rights on Vista
*
* Copyright:
* Johannes Passing (johannes.passing@googlemail.com)
*
* 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
*/
#define BANNER L"(c) 2007 - Johannes Passing - http://int3.de/\n\n"
typedef struct _COMMAND_LINE_ARGS
{
BOOL ShowHelp;
BOOL Wait;
BOOL StartComspec;
PCWSTR ApplicationName;
PCWSTR CommandLine;
} COMMAND_LINE_ARGS, *PCOMMAND_LINE_ARGS;
INT Launch(
__in PCWSTR ApplicationName,
__in PCWSTR CommandLine,
__in BOOL Wait
)
{
SHELLEXECUTEINFO Shex;
ZeroMemory( &Shex, sizeof( SHELLEXECUTEINFO ) );
Shex.cbSize = sizeof( SHELLEXECUTEINFO );
Shex.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS;
Shex.lpVerb = L"runas";
Shex.lpFile = ApplicationName;
Shex.lpParameters = CommandLine;
Shex.nShow = SW_SHOWNORMAL;
if ( ! ShellExecuteEx( &Shex ) )
{
DWORD Err = GetLastError();
fwprintf(
stderr,
L"%s could not be launched: %d\n",
ApplicationName,
Err );
return EXIT_FAILURE;
}
_ASSERTE( Shex.hProcess );
if ( Wait )
{
WaitForSingleObject( Shex.hProcess, INFINITE );
}
CloseHandle( Shex.hProcess );
return EXIT_SUCCESS;
}
INT DispatchCommand(
__in PCOMMAND_LINE_ARGS Args
)
{
WCHAR AppNameBuffer[ MAX_PATH ];
WCHAR CmdLineBuffer[ MAX_PATH * 2 ];
if ( Args->ShowHelp )
{
wprintf(
BANNER
L"Execute a process on the command line with elevated rights on Vista\n"
L"\n"
L"Usage: Elevate [-?|-wait|-k] prog [args]\n"
L"-? - Shows this help\n"
L"-wait - Waits until prog terminates\n"
L"-k - Starts the the %%COMSPEC%% environment variable value and\n"
L" executes prog in it (CMD.EXE, 4NT.EXE, etc.)\n"
L"prog - The program to execute\n"
L"args - Optional command line arguments to prog\n" );
return EXIT_SUCCESS;
}
if ( Args->StartComspec )
{
//
// Resolve COMSPEC
//
if ( 0 == GetEnvironmentVariable( L"COMSPEC", AppNameBuffer, _countof( AppNameBuffer ) ) )
{
fwprintf( stderr, L"%%COMSPEC%% is not defined\n" );
return EXIT_FAILURE;
}
Args->ApplicationName = AppNameBuffer;
//
// Prepend /K and quote arguments
//
if ( FAILED( StringCchPrintf(
CmdLineBuffer,
_countof( CmdLineBuffer ),
L"/K \"%s\"",
Args->CommandLine ) ) )
{
fwprintf( stderr, L"Creating command line failed\n" );
return EXIT_FAILURE;
}
Args->CommandLine = CmdLineBuffer;
}
//wprintf( L"App: %s,\nCmd: %s\n", Args->ApplicationName, Args->CommandLine );
return Launch( Args->ApplicationName, Args->CommandLine, Args->Wait );
}
int __cdecl wmain(
__in int Argc,
__in WCHAR* Argv[]
)
{
OSVERSIONINFO OsVer;
COMMAND_LINE_ARGS Args;
INT Index;
BOOL FlagsRead = FALSE;
WCHAR CommandLineBuffer[ 260 ] = { 0 };
ZeroMemory( &OsVer, sizeof( OSVERSIONINFO ) );
OsVer.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
ZeroMemory( &Args, sizeof( COMMAND_LINE_ARGS ) );
Args.CommandLine = CommandLineBuffer;
//
// Check OS version
//
if ( GetVersionEx( &OsVer ) &&
OsVer.dwMajorVersion < 6 )
{
fwprintf( stderr, L"This tool is for Windows Vista and above only.\n" );
return EXIT_FAILURE;
}
//
// Parse command line
//
for ( Index = 1; Index < Argc; Index++ )
{
if ( ! FlagsRead &&
( Argv[ Index ][ 0 ] == L'-' || Argv[ Index ][ 0 ] == L'/' ) )
{
PCWSTR FlagName = &Argv[ Index ][ 1 ];
if ( 0 == _wcsicmp( FlagName, L"?" ) )
{
Args.ShowHelp = TRUE;
}
else if ( 0 == _wcsicmp( FlagName, L"wait" ) )
{
Args.Wait = TRUE;
}
else if ( 0 == _wcsicmp( FlagName, L"k" ) )
{
Args.StartComspec = TRUE;
}
else
{
fwprintf( stderr, L"Unrecognized Flag %s\n", FlagName );
return EXIT_FAILURE;
}
}
else
{
FlagsRead = TRUE;
if ( Args.ApplicationName == NULL && ! Args.StartComspec )
{
Args.ApplicationName = Argv[ Index ];
}
else
{
if ( FAILED( StringCchCat(
CommandLineBuffer,
_countof( CommandLineBuffer ),
Argv[ Index ] ) ) ||
FAILED( StringCchCat(
CommandLineBuffer,
_countof( CommandLineBuffer ),
L" " ) ) )
{
fwprintf( stderr, L"Command Line too long\n" );
return EXIT_FAILURE;
}
}
}
}
#ifdef _DEBUG
wprintf(
L"ShowHelp: %s\n"
L"Wait: %s\n"
L"StartComspec: %s\n"
L"ApplicationName: %s\n"
L"CommandLine: %s\n",
Args.ShowHelp ? L"Y" : L"N",
Args.Wait ? L"Y" : L"N",
Args.StartComspec ? L"Y" : L"N",
Args.ApplicationName,
Args.CommandLine );
#endif
//
// Validate args
//
if ( Argc <= 1 )
{
Args.ShowHelp = TRUE;
}
if ( ! Args.ShowHelp &&
( ( Args.StartComspec && 0 == wcslen( Args.CommandLine ) ) ||
( ! Args.StartComspec && Args.ApplicationName == NULL ) ) )
{
fwprintf( stderr, L"Invalid arguments\n" );
return EXIT_FAILURE;
}
return DispatchCommand( &Args );
}

View File

@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Elevate.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -0,0 +1,31 @@
#pragma once
/*----------------------------------------------------------------------
* Copyright:
* Johannes Passing (johannes.passing@googlemail.com)
*
* 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
*/
#define NTDDI_VERSION NTDDI_LONGHORN
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <windows.h>
#include <strsafe.h>
#include <shellapi.h>
#include <crtdbg.h>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.