Skip to content

Commit

Permalink
deploy: 03e48ec
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 11, 2024
1 parent 1d1658c commit 4ea8760
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 14 deletions.
20 changes: 20 additions & 0 deletions catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -2362,6 +2362,26 @@
"version": "1.0.0"
}
},
"remove-quotes-from-ctrl-shift-c": {
"details": {
"defaultSorting": 0,
"published": 1733929613000,
"rating": 0,
"ratingUsers": 0,
"updated": 1733929613000,
"users": 0
},
"metadata": {
"author": "draxas",
"description": "Intercepts the copied file path (CTRL+SHIFT+C in Explorer) and removes surrounding quotes",
"github": "https://github.com/draxas",
"include": [
"explorer.exe"
],
"name": "CTRL+SHIFT+C quotes remover",
"version": "1.0"
}
},
"ribbon-caption-icon-fix": {
"details": {
"defaultSorting": 3080,
Expand Down
3 changes: 3 additions & 0 deletions changelogs/remove-quotes-from-ctrl-shift-c.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.0 ([Dec 11, 2024](https://github.com/ramensoftware/windhawk-mods/blob/03e48ec11ead99e4fff7a66162d13dcd90dca4b7/mods/remove-quotes-from-ctrl-shift-c.wh.cpp))

Initial release.
92 changes: 92 additions & 0 deletions mods/remove-quotes-from-ctrl-shift-c.wh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// ==WindhawkMod==
// @id remove-quotes-from-ctrl-shift-c
// @name CTRL+SHIFT+C quotes remover
// @description Intercepts the copied file path (CTRL+SHIFT+C in Explorer) and removes surrounding quotes
// @version 1.0
// @author draxas
// @github https://github.com/draxas
// @include explorer.exe
// ==/WindhawkMod==

// ==WindhawkModReadme==
/*
# Remove quotes from CTRL+SHIFT+C file paths
When you press `CTRL+SHIFT+C` on a file in Windows Explorer, the file’s full path is usually copied to the clipboard with quotes, for example: `"C:\Path\To\File.txt"`. With this mod, those quotes are automatically removed, leaving you with a clean, unquoted path for easier use.
## How it works
- Whenever you copy a file path using `CTRL+SHIFT+C`, this mod intercepts the text before it’s placed into the clipboard.
- If the path is enclosed in quotes, they are removed.
- You end up with a path like `C:\Path\To\File.txt` instead of `"C:\Path\To\File.txt"`.
No additional configuration is needed—just use CTRL+SHIFT+C as you normally would.
*/
// ==/WindhawkModReadme==

// ==WindhawkModSettings==
// No settings are defined for this mod.
// ==/WindhawkModSettings==

#include <windows.h>
#include <wchar.h>

typedef HANDLE (WINAPI *SetClipboardData_t)(UINT uFormat, HANDLE hMem);
SetClipboardData_t SetClipboardData_Original;

static void RemoveSurroundingQuotes(wchar_t* str) {
size_t len = wcslen(str);
if (len >= 2 && str[0] == L'\"' && str[len - 1] == L'\"') {
wmemmove(str, str + 1, len - 2);
str[len - 2] = L'\0';
}
}

HANDLE WINAPI SetClipboardData_Hook(UINT uFormat, HANDLE hMem) {
if (uFormat == CF_UNICODETEXT && hMem) {
LPWSTR pData = (LPWSTR)GlobalLock(hMem);
if (pData) {
size_t len = wcslen(pData);
wchar_t* buffer = (wchar_t*)HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(wchar_t));
if (buffer) {
wcscpy_s(buffer, len + 1, pData);
GlobalUnlock(hMem);

RemoveSurroundingQuotes(buffer);

size_t newLen = wcslen(buffer);
HGLOBAL hNew = GlobalAlloc(GMEM_MOVEABLE, (newLen + 1) * sizeof(wchar_t));
if (hNew) {
LPWSTR pNewData = (LPWSTR)GlobalLock(hNew);
if (pNewData) {
wcscpy_s(pNewData, newLen + 1, buffer);
GlobalUnlock(hNew);
HeapFree(GetProcessHeap(), 0, buffer);
return SetClipboardData_Original(uFormat, hNew);
}
GlobalFree(hNew);
}
HeapFree(GetProcessHeap(), 0, buffer);
} else {
GlobalUnlock(hMem);
}
}
}

return SetClipboardData_Original(uFormat, hMem);
}

BOOL Wh_ModInit() {
Wh_Log(L"Init remove-quotes-from-ctrl-shift-c mod");

Wh_SetFunctionHook((void*)SetClipboardData, (void*)SetClipboardData_Hook, (void**)&SetClipboardData_Original);

return TRUE;
}

void Wh_ModUninit() {
Wh_Log(L"Uninit remove-quotes-from-ctrl-shift-c mod");
}

void Wh_ModSettingsChanged() {
Wh_Log(L"SettingsChanged remove-quotes-from-ctrl-shift-c mod");
}
34 changes: 20 additions & 14 deletions updates.atom
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,31 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id>https://windhawk.net/</id>
<title>Windhawk Mod Updates</title>
<updated>2024-12-10T14:57:10.000Z</updated>
<updated>2024-12-11T15:06:53.000Z</updated>
<generator>https://github.com/jpmonette/feed</generator>
<link rel="alternate" href="https://windhawk.net/"/>
<subtitle>Updates in the official collection of Windhawk mods</subtitle>
<icon>https://windhawk.net/favicon.ico</icon>
<rights>Ramen Software</rights>
<entry>
<title type="html"><![CDATA[CTRL+SHIFT+C quotes remover 1.0]]></title>
<id>https://windhawk.net/mods/remove-quotes-from-ctrl-shift-c#03e48ec11ead99e4fff7a66162d13dcd90dca4b7</id>
<link href="https://windhawk.net/mods/remove-quotes-from-ctrl-shift-c"/>
<updated>2024-12-11T15:06:53.000Z</updated>
<content type="html"><![CDATA[<h1 id="removequotesfromctrlshiftcfilepaths">Remove quotes from CTRL+SHIFT+C file paths</h1>
<p>When you press <code>CTRL+SHIFT+C</code> on a file in Windows Explorer, the file’s full path is usually copied to the clipboard with quotes, for example: <code>"C:\Path\To\File.txt"</code>. With this mod, those quotes are automatically removed, leaving you with a clean, unquoted path for easier use.</p>
<h2 id="howitworks">How it works</h2>
<ul>
<li>Whenever you copy a file path using <code>CTRL+SHIFT+C</code>, this mod intercepts the text before it’s placed into the clipboard.</li>
<li>If the path is enclosed in quotes, they are removed.</li>
<li>You end up with a path like <code>C:\Path\To\File.txt</code> instead of <code>"C:\Path\To\File.txt"</code>.</li>
</ul>
<p>No additional configuration is needed—just use CTRL+SHIFT+C as you normally would.</p>]]></content>
<author>
<name>draxas</name>
<uri>https://github.com/draxas</uri>
</author>
</entry>
<entry>
<title type="html"><![CDATA[Windows 11 Start Menu Styler 1.2]]></title>
<id>https://windhawk.net/mods/windows-11-start-menu-styler#8db53b86b7fb576eaf44aaa772c00a53a8933590</id>
Expand Down Expand Up @@ -288,19 +307,6 @@ center, etc. to another monitor.</p>
<updated>2024-11-16T00:41:37.000Z</updated>
<content type="html"><![CDATA[<ul>
<li>Fix resource leak</li>
</ul>]]></content>
<author>
<name>aubymori</name>
<uri>https://github.com/aubymori</uri>
</author>
</entry>
<entry>
<title type="html"><![CDATA[Fix Basic Caption Text 1.1.1]]></title>
<id>https://windhawk.net/mods/fix-basic-caption-text#2613791dbe45f4777ff658a06d3cb430e8b26285</id>
<link href="https://windhawk.net/mods/fix-basic-caption-text"/>
<updated>2024-11-15T07:36:59.000Z</updated>
<content type="html"><![CDATA[<ul>
<li>Make behavior accurate to Windows 7; custom frames (e.g. UIRibbon) will always show active color when composition is enabled</li>
</ul>]]></content>
<author>
<name>aubymori</name>
Expand Down

0 comments on commit 4ea8760

Please sign in to comment.