From 92d7060bbd341b2793e6450710f4400e01b0890e Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 24 Sep 2007 18:00:49 +0100 Subject: [PATCH] Add a tool to broadcast to all programs that the environment changed When setting some system wide environment variable (such as PATH) in the registry, you still have to tell everybody about it. This small tool helps to do so. Signed-off-by: Johannes Schindelin --- share/WinGit/Makefile | 6 +++++- share/WinGit/broadcast-environment-change.c | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 share/WinGit/broadcast-environment-change.c diff --git a/share/WinGit/Makefile b/share/WinGit/Makefile index 95f836fb7a..0193a39d9d 100644 --- a/share/WinGit/Makefile +++ b/share/WinGit/Makefile @@ -1,6 +1,10 @@ CFLAGS=-O2 -Wall -pedantic -all: create-shortcut.exe uninstaller.exe +all: broadcast-environment-change.exe create-shortcut.exe uninstaller.exe + +broadcast-environment-change.exe: broadcast-environment-change.o + $(CC) $(CFLAGS) -o $@ $< + strip $@ create-shortcut.exe: create-shortcut.o $(CC) $(CFLAGS) -o $@ $< -luuid -lole32 diff --git a/share/WinGit/broadcast-environment-change.c b/share/WinGit/broadcast-environment-change.c new file mode 100644 index 0000000000..f299d109aa --- /dev/null +++ b/share/WinGit/broadcast-environment-change.c @@ -0,0 +1,8 @@ +#include + +int main(int argc, char **argv) +{ + DWORD result; + return !SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, + 0, (LPARAM)"Environment", SMTO_ABORTIFHUNG, 500, &result); +} -- 2.11.4.GIT