Skip to content

Commit

Permalink
Merge pull request #170 from end2endzone/feature-issue110
Browse files Browse the repository at this point in the history
Merge feature-issue110
  • Loading branch information
end2endzone authored Aug 30, 2024
2 parents 96253fd + 0023f3b commit 8ca8c57
Show file tree
Hide file tree
Showing 25 changed files with 890 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
Changes for 0.10.0

* Shellanything now features verbose logging mode and command line arguments debugging tools.
* Fixed issue #6 : (twice) Right-click on a directory with Windows Explorer in the left panel shows the menus twice.
* Fixed issue #31 : (twice) Error in logs for CContextMenu::GetCommandString()
* Fixed issue #109: Implement default and verbose logging.
* Fixed issue #110: Create a simple command line arguments debugging application.
* Fixed issue #150: ico icon (that do not specifically force index=0) are not working.
* Fixed issue #157: Compilation fails on Github Action: `fatal error C1083: Cannot open include file: 'atlbase.h': No such file or directory`.
* Fixed issue #158: Compilation fails on Github Action: `CPack error : Problem running WiX.`.
Expand Down
77 changes: 77 additions & 0 deletions UserManual.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ This manual includes a description of the system functionalities and capabilitie
* [Fixed properties](#fixed-properties)
* [Default properties](#default-properties)
* [Environment variables](#environment-variables)
* [Tools](#tools)
* [file_explorer_renew](#file_explorer_renew)
* [arguments.debugger](#argumentsdebugger)
* [Plugins](#plugins)
* [Plugin overview](#plugin-overview)
* [C API](#c-api)
Expand Down Expand Up @@ -74,6 +77,7 @@ This manual includes a description of the system functionalities and capabilitie
* [Keyboard mnemonics](#mnemonics--keyboard-shortcuts)
* [Troubleshooting](#troubleshooting)
* [Logging support](#logging-support)
* [Checkout the _Tools_ section](#tools)
* [Missing ampersand character (`&`) in menus](#missing-ampersand-character--in-menus)
* [Reporting bugs](#reporting-bugs)

Expand Down Expand Up @@ -1796,6 +1800,79 @@ The following table defines the list of pre-defined environment variables for Sh



# Tools #


## file_explorer_renew ##

**file_explorer_renew** is an utility provided with ShellAnything that can close and reopen all File Explorer windows.

Shell Extension DLLs cannot be easily deleted because _File Explorer_ usually have a lock on the file. File Explorer Renew is used to force File Explorer to release file locks on shell extentions such as ShellAnything.

The utility is useful during the [uninstall process](https://github.com/end2endzone/ShellAnything/blob/master/INSTALL.md#uninstall). For more details, see the [uninstall section of INSTALL.md](https://github.com/end2endzone/ShellAnything/blob/master/INSTALL.md#uninstall).



## arguments.debugger ##

**arguments debugger** is a set of two applications for debugging command line arguments sent to a program. When launched, they display individual arguments that started their process.

There are two applications `arguments.debugger.console.exe` and `arguments.debugger.window.exe`. The first is a console application, the second is a windows application. Both applications will show the individual command line arguments received from [<exec> action](#exec-action).

This tool allows one to validate that he properly escaped string values to use as command line parameters. Test your <exec> actions with _arguments.debugger_ until all your arguments are ready. Then switch your actions to launch your actual programs.

For example, if you execute the following menu action:
```xml
<menu name="arguments.debugger">
<actions>
<exec
path="${application.directory}\arguments.debugger.window.exe"
arguments="This is &quot;multiple arguments at once&quot; including &quot;utf-8 characters&quot; such as the Greek alphabet Αα Ββ Γγ Δδ Εε Ζζ Ηη Θθ Ιι Κκ Λλ Μμ Νν Ξξ Οο Ππ Ρρ Σσ/ς Ττ Υυ Φφ Χχ Ψψ Ωω."
/>
</actions>
</menu>
```
arguments.debugger.window.exe will starts and show the following arguments:
```
argc=35
argv[0]=C:\Program Files\ShellAnything\bin\arguments.debugger.window.exe
argv[1]=This
argv[2]=is
argv[3]=multiple arguments at once
argv[4]=including
argv[5]=utf-8 characters
argv[6]=such
argv[7]=as
argv[8]=the
argv[9]=Greek
argv[10]=alphabet
argv[11]=Αα
argv[12]=Ββ
argv[13]=Γγ
argv[14]=Δδ
argv[15]=Εε
argv[16]=Ζζ
argv[17]=Ηη
argv[18]=Θθ
argv[19]=Ιι
argv[20]=Κκ
argv[21]=Λλ
argv[22]=Μμ
argv[23]=Νν
argv[24]=Ξξ
argv[25]=Οο
argv[26]=Ππ
argv[27]=Ρρ
argv[28]=Σσ/ς
argv[29]=Ττ
argv[30]=Υυ
argv[31]=Φφ
argv[32]=Χχ
argv[33]=Ψψ
argv[34]=Ωω.
```

# Plugins #


Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ add_subdirectory(api)
add_subdirectory(logger/glog)
add_subdirectory(windows)
add_subdirectory(file_explorer_renew)
add_subdirectory(arguments.debugger.console)
add_subdirectory(arguments.debugger.window)

if(SHELLANYTHING_BUILD_PLUGINS)
add_subdirectory(plugins/sa_plugin_process)
Expand Down
51 changes: 51 additions & 0 deletions src/arguments.debugger.console/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
find_package(rapidassist REQUIRED)

set(REFRESH_DEBUG_ARGS_CON_RESOURCE_FILES ""
resource.h
showargs.ico
showargs.rc
)

add_executable(arguments.debugger.console
${SHELLANYTHING_EXPORT_HEADER}
${SHELLANYTHING_VERSION_HEADER}
${SHELLANYTHING_CONFIG_HEADER}
${REFRESH_DEBUG_ARGS_CON_RESOURCE_FILES}
../arguments.debugger.window/arguments.cpp
../arguments.debugger.window/arguments.h
framework.h
main.cpp
targetver.h
)

# Group external files as filter for Visual Studio
source_group("Resource Files" FILES ${REFRESH_DEBUG_ARGS_CON_RESOURCE_FILES})

# Force UNICODE for target
target_compile_definitions(arguments.debugger.console PRIVATE -D_UNICODE -DUNICODE)

# Force CMAKE_DEBUG_POSTFIX for executables
set_target_properties(arguments.debugger.console PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})

# Define include directories for the executable.
target_include_directories(arguments.debugger.console
PRIVATE
${GTEST_INCLUDE_DIR}
rapidassist
${CMAKE_SOURCE_DIR}/src/shared
)

# Define linking dependencies.
add_dependencies(arguments.debugger.console sa.shared)
target_link_libraries(arguments.debugger.console
PRIVATE
sa.shared
rapidassist
)

install(TARGETS arguments.debugger.console
EXPORT shellanything-targets
ARCHIVE DESTINATION ${SHELLANYTHING_INSTALL_LIB_DIR}
LIBRARY DESTINATION ${SHELLANYTHING_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${SHELLANYTHING_INSTALL_BIN_DIR}
)
15 changes: 15 additions & 0 deletions src/arguments.debugger.console/framework.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// header.h : include file for standard system include files,
// or project specific include files
//

#pragma once

#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>
// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
42 changes: 42 additions & 0 deletions src/arguments.debugger.console/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <iostream>
#include <io.h>
#include <fcntl.h>
#include <string>
#include "framework.h"
#include "../arguments.debugger.window/arguments.h"

#include "rapidassist/console.h"


// Debug arguments example:
// This is "multiple arguments at once" including "utf-8 characters" such as the Greek alphabet Αα Ββ Γγ Δδ Εε Ζζ Ηη Θθ Ιι Κκ Λλ Μμ Νν Ξξ Οο Ππ Ρρ Σσ/ς Ττ Υυ Φφ Χχ Ψψ Ωω.


// https://stackoverflow.com/questions/33836706/what-are-tchar-strings-and-the-a-or-w-version-of-win32-api-functions

#if defined(UNICODE)
std::wistream& tcin = std::wcin;
std::wostream& tcout = std::wcout;
#else
std::istream& tcin = std::cin;
std::ostream& tcout = std::cout;
#endif

int _tmain(int argc, _TCHAR* argv[])
{
_setmode(_fileno(stdout), _O_U16TEXT);

// The string that appears in the application's title bar.
tcout << _T("ShellAything Arguments Debugging Application\n");

tstring_t arguments_desc;
ReadCommandLineArguments(arguments_desc);

tcout << arguments_desc << "\n";

tcout << "Press any key to continue . . .";
int tmp = ra::console::WaitKeyPress();
tcout << "\n";

return 0;
}
29 changes: 29 additions & 0 deletions src/arguments.debugger.console/resource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by showargs.rc

#define IDS_APP_TITLE 103
//
#define IDR_MAINFRAME 128
#define IDD_SHOWARGS_DIALOG 102
#define IDD_ABOUTBOX 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDI_SHOWARGS 107
#define IDC_SHOWARGS 109
#define ID_EDITCHILD 129
#ifndef IDC_STATIC
#define IDC_STATIC -1
#endif
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS

#define _APS_NO_MFC 130
#define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif
Binary file added src/arguments.debugger.console/showargs.ico
Binary file not shown.
Binary file added src/arguments.debugger.console/showargs.rc
Binary file not shown.
6 changes: 6 additions & 0 deletions src/arguments.debugger.console/targetver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

// // Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>
51 changes: 51 additions & 0 deletions src/arguments.debugger.window/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
find_package(rapidassist REQUIRED)

set(REFRESH_DEBUG_ARGS_WIN_RESOURCE_FILES ""
resource.h
showargs.ico
showargs.rc
)

add_executable(arguments.debugger.window WIN32
${SHELLANYTHING_EXPORT_HEADER}
${SHELLANYTHING_VERSION_HEADER}
${SHELLANYTHING_CONFIG_HEADER}
${REFRESH_DEBUG_ARGS_WIN_RESOURCE_FILES}
arguments.cpp
arguments.h
framework.h
gui.cpp
targetver.h
)

# Group external files as filter for Visual Studio
source_group("Resource Files" FILES ${REFRESH_DEBUG_ARGS_WIN_RESOURCE_FILES})

# Force UNICODE for target
target_compile_definitions(arguments.debugger.window PRIVATE -D_UNICODE -DUNICODE)

# Force CMAKE_DEBUG_POSTFIX for executables
set_target_properties(arguments.debugger.window PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})

# Define include directories for the executable.
target_include_directories(arguments.debugger.window
PRIVATE
${GTEST_INCLUDE_DIR}
rapidassist
${CMAKE_SOURCE_DIR}/src/shared
)

# Define linking dependencies.
add_dependencies(arguments.debugger.window sa.shared)
target_link_libraries(arguments.debugger.window
PRIVATE
sa.shared
rapidassist
)

install(TARGETS arguments.debugger.window
EXPORT shellanything-targets
ARCHIVE DESTINATION ${SHELLANYTHING_INSTALL_LIB_DIR}
LIBRARY DESTINATION ${SHELLANYTHING_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${SHELLANYTHING_INSTALL_BIN_DIR}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://learn.microsoft.com/en-us/windows/win32/controls/use-a-multiline-edit-control
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://learn.microsoft.com/en-us/cpp/windows/walkthrough-creating-windows-desktop-applications-cpp?view=msvc-170
Loading

0 comments on commit 8ca8c57

Please sign in to comment.