7013109: windows application manifest problems
6820955: Update application manifests with new Windows 7 dpiAware section
Reviewed-by: ohair, art
diff --git a/make/common/Defs-windows.gmk b/make/common/Defs-windows.gmk
index 19a7f6a..63f19d3 100644
--- a/make/common/Defs-windows.gmk
+++ b/make/common/Defs-windows.gmk
@@ -365,10 +365,6 @@
 
   # LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
   BASELFLAGS = -nologo /opt:REF /incremental:no
-ifdef MT
-    # VS2005, VS2008, and beyond: ask LINK to generate manifests for .dll & .exe
-    BASELFLAGS += /manifest
-endif
 
   LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION))
   LDDFLAGS += $(LFLAGS_$(COMPILER_VERSION))
diff --git a/make/common/Library.gmk b/make/common/Library.gmk
index 7175827..c70d0c4 100644
--- a/make/common/Library.gmk
+++ b/make/common/Library.gmk
@@ -159,9 +159,6 @@
 # build it into $(OBJDIR) so that the other generated files get put 
 # there, then copy just the DLL (and MAP file) to the requested directory.
 #
-# In VS2005 or VS2008 the link command creates a .manifest file that we want
-# to insert into the linked artifact so we do not need to track it separately.
-# Use ";#2" for .dll and ";#1" for .exe in the MT command below:
 $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf
 	@$(prep-target)
 	@$(MKDIR) -p $(OBJDIR)
@@ -169,9 +166,6 @@
 	  -map:$(OBJDIR)/$(LIBRARY).map \
 	  $(LFLAGS) @$(OBJDIR)/$(LIBRARY).lcf \
 	  $(OTHER_LCF) $(JAVALIB) $(LDLIBS)
-ifdef MT
-	$(MT) /manifest $(OBJDIR)/$(@F).manifest /outputresource:$(OBJDIR)/$(@F);#2
-endif
 	$(CP) $(OBJDIR)/$(@F) $@
 	$(install-module-file)
 	$(CP) $(OBJDIR)/$(LIBRARY).map $(@D)
diff --git a/make/common/Program.gmk b/make/common/Program.gmk
index 0052361..751f0fe 100644
--- a/make/common/Program.gmk
+++ b/make/common/Program.gmk
@@ -142,10 +142,15 @@
   STACK_SIZE=1048576
 endif
 
-# In VS2005 or VS2008 the link command creates a .manifest file that we want
-# to insert into the linked artifact so we do not need to track it separately.
+IMVERSION=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)
+$(OBJDIR)/$(PROGRAM).exe.manifest: $(JDK_TOPDIR)/src/windows/resource/java.manifest
+	@$(prep-target)
+	$(SED) 's%IMVERSION%$(IMVERSION)%g;s%PROGRAM%$(PROGRAM)%g' $< > $@
+
+# We used a hand-crafted manifest file for all executables.
+# It is tweaked to embed the build number and executable name.
 # Use ";#2" for .dll and ";#1" for .exe in the MT command below:
-$(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LCF) 
+$(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LCF) $(OBJDIR)/$(PROGRAM).exe.manifest
 	@$(prep-target)
 	@set -- $?; \
 	    $(ECHO) Rebuilding $@ because of $$1 $$2 $$3 $$4 $$5 $$6 $${7:+...};
diff --git a/src/windows/resource/java.manifest b/src/windows/resource/java.manifest
index 61ec599..e5b4460 100644
--- a/src/windows/resource/java.manifest
+++ b/src/windows/resource/java.manifest
@@ -1,12 +1,15 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
+          manifestVersion="1.0"
+          xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
+>
 <assemblyIdentity
-    version="1.0.0.0"
+    version="IMVERSION"
     processorArchitecture="X86"
     name="Oracle Corporation, Java(tm) 2 Standard Edition"
     type="win32"
 />
-<description>AWT</description>
+<description>Java(TM) SE PROGRAM process</description>
 <dependency>
     <dependentAssembly>
         <assemblyIdentity
@@ -19,4 +22,23 @@
         />
     </dependentAssembly>
 </dependency>
+
+  <!-- Identify the application security requirements. -->
+  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+    <security>
+      <requestedPrivileges>
+        <requestedExecutionLevel
+          level="asInvoker"
+          uiAccess="false"/>
+        </requestedPrivileges>
+       </security>
+  </trustInfo>
+
+  <!-- Indicate JDK is high-dpi aware. -->
+  <asmv3:application>
+    <asmv3:windowsSettings  xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
+       <dpiAware>true</dpiAware>
+    </asmv3:windowsSettings>
+  </asmv3:application>
+
 </assembly>