Skip to content

Commit 2b36fc1

Browse files
author
Alexey Bakhtin
committed
8345358: Some DLL Files are missing Windows Properties
Reviewed-by: andrew, serb
1 parent 86ecd5b commit 2b36fc1

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

jdk/make/lib/SecurityLibraries.gmk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS, \
107107
$(call SET_SHARED_LIBRARY_ORIGIN), \
108108
LDFLAGS_SUFFIX := $(LIBDL), \
109109
LDFLAGS_SUFFIX_solaris := -lc, \
110+
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
111+
RC_FLAGS := $(RC_FLAGS) \
112+
-D "JDK_FNAME=j2gss.dll" \
113+
-D "JDK_INTERNAL_NAME=j2gss" \
114+
-D "JDK_FTYPE=0x2L", \
110115
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2gss, \
111116
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
112117

@@ -124,6 +129,11 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
124129
LDFLAGS := $(LDFLAGS_JDKLIB) \
125130
$(call SET_SHARED_LIBRARY_ORIGIN), \
126131
LDFLAGS_SUFFIX := $(LIBDL), \
132+
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
133+
RC_FLAGS := $(RC_FLAGS) \
134+
-D "JDK_FNAME=sspi_bridge.dll" \
135+
-D "JDK_INTERNAL_NAME=sspi_bridge" \
136+
-D "JDK_FTYPE=0x2L", \
127137
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsspi_bridge, \
128138
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
129139

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* @test
26+
* @bug 8345358
27+
* @run main/othervm CheckWindowsProperty
28+
* @summary file property check for Windows .exe/.dll
29+
* @requires os.family == "windows"
30+
*/
31+
32+
import java.io.BufferedReader;
33+
import java.io.InputStreamReader;
34+
35+
public class CheckWindowsProperty {
36+
public static void main(String[] args) throws Exception {
37+
String targetDir = System.getProperty("test.jdk") + "\\";
38+
String psCommand = String.format(
39+
"Get-ChildItem -Path '%s' -include *.exe,*.dll -Recurse -File | " +
40+
"ForEach-Object { " +
41+
"$vi = $_.VersionInfo; " +
42+
"@($vi.FileName, $vi.CompanyName, $vi.FileDescription, $vi.FileVersion, " +
43+
"$vi.InternalName, $vi.Language, $vi.LegalCopyright, $vi.OriginalFilename, " +
44+
"$vi.ProductName, $vi.ProductVersion) -join ';'" +
45+
"}",
46+
targetDir
47+
);
48+
49+
ProcessBuilder pb = new ProcessBuilder("powershell", "-NoLogo", "-NoProfile",
50+
"-Command", psCommand).redirectErrorStream(true);
51+
Process p = pb.start();
52+
p.getOutputStream().close();
53+
54+
try (BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
55+
for (String line = br.readLine(); line != null; line = br.readLine()) {
56+
checkFileProperty(line);
57+
}
58+
}
59+
p.waitFor();
60+
int exitCode = p.exitValue();
61+
if (exitCode != 0) {
62+
throw new RuntimeException("ExitCode is " + exitCode + ". PowerShell command failed.");
63+
}
64+
}
65+
66+
static void checkFileProperty(String line) {
67+
// line format
68+
// FileName;CompanyName;FileDescription;FileVersion;InternalName;Language;LegalCopyright;
69+
// OriginalFilename;ProductName;ProductVersion
70+
String[] data = line.split(";", -1);
71+
String filename = data[0].substring(data[0].lastIndexOf(System.getProperty("file.separator")) + 1);
72+
73+
// skip Microsoft redist dll
74+
if (filename.startsWith("api-ms-win") ||
75+
filename.startsWith("msvcp") ||
76+
filename.startsWith("ucrtbase") ||
77+
filename.startsWith("vcruntime")) {
78+
return;
79+
}
80+
81+
for (int i = 1; i < data.length; i++) {
82+
if (data[i] == null || data[i].isEmpty()) {
83+
if (!filename.equals("freetype.dll") && !filename.equals("sawindbg.dll")) {
84+
throw new RuntimeException("data[" + i + "] should not be empty for " + filename);
85+
}
86+
}
87+
}
88+
}
89+
}

0 commit comments

Comments
 (0)