Skip to content

Commit

Permalink
git-extra: link executables as terminal server aware
Browse files Browse the repository at this point in the history
Whith Windows 2000, Microsoft introduced a flag to the PE header to mark executables as
"terminal server aware". Windows terminal servers provide a redirected Windows directory and
redirected registry hives when launching legacy applications without this flag set. Since we
do not use any INI files in the Windows directory and don't write to the registry, we don't
need  this additional preparation. Telling the OS that we don't need this should provide
slightly improved startup times in terminal server environments.

This partially addresses git-for-windows/git#3935

Signed-off-by: Matthias Aßhauer <mha1993@live.de>
  • Loading branch information
rimrul committed Jul 11, 2022
1 parent fe3c9e3 commit 60053bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions git-extra/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ SRCDIR ?= .
WINDRES ?= windres
CFLAGS ?= -Wall
CXXFLAGS ?= -Wall
LDFLAGS = -Wl,--tsaware

all: $(BUILDDIR)/create-shortcut.exe $(BUILDDIR)/WhoUses.exe \
$(BUILDDIR)/blocked-file-util.exe $(BUILDDIR)/proxy-lookup.exe \
Expand All @@ -11,7 +12,7 @@ all: $(BUILDDIR)/create-shortcut.exe $(BUILDDIR)/WhoUses.exe \
$(BUILDDIR)/git-credential-helper-selector.exe

$(BUILDDIR)/create-shortcut.exe: $(BUILDDIR)/create-shortcut.o
$(CC) $(CFLAGS) -o $@ $^ -luuid -lole32
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $^ -luuid -lole32

$(BUILDDIR)/%.o: $(SRCDIR)/%.c
$(CC) -c $(CFLAGS) $< -o $@
Expand All @@ -20,7 +21,7 @@ $(BUILDDIR)/%.res: $(SRCDIR)/%.rc
$(WINDRES) --input $< --output $@ --output-format coff

$(BUILDDIR)/WhoUses.exe: $(BUILDDIR)/WhoUses.o $(BUILDDIR)/SystemInfo.o
$(CXX) $(CXXFLAGS) -o $@ $^
$(CXX) $(CXXFLAGS) -o $@ $(LDFLAGS) $^

$(BUILDDIR)/WhoUses.o: $(SRCDIR)/WhoUses.cpp $(SRCDIR)/SystemInfo.h
$(BUILDDIR)/SystemInfo.o: $(SRCDIR)/SystemInfo.cpp $(SRCDIR)/SystemInfo.h
Expand All @@ -29,31 +30,31 @@ $(BUILDDIR)/%.o: $(SRCDIR)/%.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@

$(BUILDDIR)/blocked-file-util.exe: $(BUILDDIR)/blocked-file-util.o
$(CC) $(CFLAGS) -o $@ $^
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $^

$(BUILDDIR)/proxy-lookup.o: CFLAGS += -DUNICODE

$(BUILDDIR)/proxy-lookup.exe: $(BUILDDIR)/proxy-lookup.o
$(CC) -municode $(CFLAGS) -o $@ $^ -lshell32 -lwinhttp
$(CC) -municode $(CFLAGS) -o $@ $(LDFLAGS) $^ -lshell32 -lwinhttp

$(BUILDDIR)/git-askyesno.o: CFLAGS += -DUNICODE

$(BUILDDIR)/git-askyesno.exe: $(BUILDDIR)/git-askyesno.o
$(CC) -municode $(CFLAGS) -o $@ $^
$(CC) -municode $(CFLAGS) -o $@ $(LDFLAGS) $^

$(BUILDDIR)/git-credential-helper-selector.o: CFLAGS += -DUNICODE

$(BUILDDIR)/git-credential-helper-selector.exe: \
$(BUILDDIR)/git-credential-helper-selector.o \
$(BUILDDIR)/git-credential-helper-selector.res
$(CC) -municode $(CFLAGS) -o $@ $^ -lgdi32 -lcomctl32
$(CC) -municode $(CFLAGS) -o $@ $(LDFLAGS) $^ -lgdi32 -lcomctl32

$(BUILDDIR)/git-askpass.o: CFLAGS += -DUNICODE

$(BUILDDIR)/git-askpass.exe: \
$(BUILDDIR)/git-askpass.o \
$(BUILDDIR)/git-askpass.res
$(CC) -municode $(CFLAGS) -o $@ $^
$(CC) -municode $(CFLAGS) -o $@ $(LDFLAGS) $^
clean:
$(RM) $(BUILDDIR)/create-shortcut.exe $(BUILDDIR)/create-shortcut.o
$(RM) $(BUILDDIR)/WhoUses.exe $(BUILDDIR)/WhoUses.o \
Expand Down
2 changes: 1 addition & 1 deletion git-extra/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ sha256sums=('8ed76d1cb069ac8568f21c431f5e23caebea502d932ab4cdff71396f4f0d5b72'
'3cd83627f1d20e1108533419fcf33c657cbcf777c3dc39fa7f13748b7d63858a'
'd51229e5ec3653782a2c09aa5ad9af8f159aba94bc28498d7f358c33399b313d'
'4716d520e7e6e0a1281bad1ae4c21e3e6442127c3030d27681162b9c40aa6b9d'
'b551341275bfed94c902e5f820f4b2d0194c479ec477256790141e923c9e7bb0'
'937e25c096e0fa91f86f689a00a5bf5442c2333fbedab30239a935e682ae2e80'
'd212e1bbe75a9f81443126701324c9c44c3ed5750dd9822eba754a1799ed13b3'
'402c51eba82453a76f5110f4754bb1005df507a6e4532574c2b9627ff4e1dc81'
'd9024bab283ebb67b5d39d49ee5d2592e170abf1f92d3db34edcdd7eeed0b6b9'
Expand Down

0 comments on commit 60053bf

Please sign in to comment.