Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
0128b684
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0128b684
编写于
6月 27, 2014
作者:
M
mfang
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
f7507e14
7a42cf96
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
248 addition
and
68 deletion
+248
-68
.hgtags
.hgtags
+1
-0
make/CompileJavaClasses.gmk
make/CompileJavaClasses.gmk
+2
-1
src/share/classes/java/lang/management/ManagementFactory.java
...share/classes/java/lang/management/ManagementFactory.java
+35
-3
src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java
...classes/jdk/internal/org/objectweb/asm/tree/InsnList.java
+1
-0
src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodNode.java
...asses/jdk/internal/org/objectweb/asm/tree/MethodNode.java
+1
-0
src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java
...dk/internal/org/objectweb/asm/tree/analysis/Analyzer.java
+1
-0
src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Frame.java
...s/jdk/internal/org/objectweb/asm/tree/analysis/Frame.java
+1
-0
src/share/classes/jdk/internal/org/objectweb/asm/version.txt
src/share/classes/jdk/internal/org/objectweb/asm/version.txt
+5
-5
src/share/classes/jdk/net/Sockets.java
src/share/classes/jdk/net/Sockets.java
+4
-0
src/share/classes/sun/awt/shell/ShellFolder.java
src/share/classes/sun/awt/shell/ShellFolder.java
+7
-6
src/share/classes/sun/management/ExtendedPlatformComponent.java
...are/classes/sun/management/ExtendedPlatformComponent.java
+54
-0
src/windows/native/java/io/WinNTFileSystem_md.c
src/windows/native/java/io/WinNTFileSystem_md.c
+13
-4
src/windows/native/java/io/io_util_md.c
src/windows/native/java/io/io_util_md.c
+11
-6
src/windows/native/java/lang/ProcessEnvironment_md.c
src/windows/native/java/lang/ProcessEnvironment_md.c
+16
-6
src/windows/native/java/lang/ProcessImpl_md.c
src/windows/native/java/lang/ProcessImpl_md.c
+22
-18
src/windows/native/java/util/WindowsPreferences.c
src/windows/native/java/util/WindowsPreferences.c
+51
-16
src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c
.../native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c
+23
-3
未找到文件。
.hgtags
浏览文件 @
0128b684
...
@@ -289,3 +289,4 @@ bf4acb74e4a82d6126ad7a82bd8c52bdcce4bc8d jdk8u20-b14
...
@@ -289,3 +289,4 @@ bf4acb74e4a82d6126ad7a82bd8c52bdcce4bc8d jdk8u20-b14
d723d05cd17afd5c4dd4293bcba83fef44a3c0bb jdk8u20-b16
d723d05cd17afd5c4dd4293bcba83fef44a3c0bb jdk8u20-b16
31433e5da5bcfd107381f281058dc80377f04d23 jdk8u20-b17
31433e5da5bcfd107381f281058dc80377f04d23 jdk8u20-b17
266302e9c31172984493404d5b223979315b59ac jdk8u20-b18
266302e9c31172984493404d5b223979315b59ac jdk8u20-b18
38548d32c91cfa57b1d31eec0a5e79c936e86f11 jdk8u20-b19
make/CompileJavaClasses.gmk
浏览文件 @
0128b684
...
@@ -52,8 +52,9 @@ ifdef OPENJDK
...
@@ -52,8 +52,9 @@ ifdef OPENJDK
endif
endif
ifndef OPENJDK
ifndef OPENJDK
# There exists two versions of th
is file
...
# There exists two versions of th
ese files
...
EXFILES := $(JDK_TOPDIR)/src/share/classes/javax/crypto/JarVerifier.java
EXFILES := $(JDK_TOPDIR)/src/share/classes/javax/crypto/JarVerifier.java
EXFILES += $(JDK_TOPDIR)/src/share/classes/sun/management/ExtendedPlatformComponent.java
ifeq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(OPENJDK_TARGET_OS), windows)
# This gets built on unix platforms implicitly in the old build even though
# This gets built on unix platforms implicitly in the old build even though
...
...
src/share/classes/java/lang/management/ManagementFactory.java
浏览文件 @
0128b684
...
@@ -52,6 +52,7 @@ import java.security.PrivilegedActionException;
...
@@ -52,6 +52,7 @@ import java.security.PrivilegedActionException;
import
java.security.PrivilegedExceptionAction
;
import
java.security.PrivilegedExceptionAction
;
import
javax.management.JMX
;
import
javax.management.JMX
;
import
sun.management.ManagementFactoryHelper
;
import
sun.management.ManagementFactoryHelper
;
import
sun.management.ExtendedPlatformComponent
;
/**
/**
* The {@code ManagementFactory} class is a factory class for getting
* The {@code ManagementFactory} class is a factory class for getting
...
@@ -489,6 +490,12 @@ public class ManagementFactory {
...
@@ -489,6 +490,12 @@ public class ManagementFactory {
for
(
Map
.
Entry
<
ObjectName
,
DynamicMBean
>
e
:
dynmbeans
.
entrySet
())
{
for
(
Map
.
Entry
<
ObjectName
,
DynamicMBean
>
e
:
dynmbeans
.
entrySet
())
{
addDynamicMBean
(
platformMBeanServer
,
e
.
getValue
(),
e
.
getKey
());
addDynamicMBean
(
platformMBeanServer
,
e
.
getValue
(),
e
.
getKey
());
}
}
for
(
final
PlatformManagedObject
o
:
ExtendedPlatformComponent
.
getMXBeans
())
{
if
(!
platformMBeanServer
.
isRegistered
(
o
.
getObjectName
()))
{
addMXBean
(
platformMBeanServer
,
o
);
}
}
}
}
return
platformMBeanServer
;
return
platformMBeanServer
;
}
}
...
@@ -655,9 +662,14 @@ public class ManagementFactory {
...
@@ -655,9 +662,14 @@ public class ManagementFactory {
public
static
<
T
extends
PlatformManagedObject
>
public
static
<
T
extends
PlatformManagedObject
>
T
getPlatformMXBean
(
Class
<
T
>
mxbeanInterface
)
{
T
getPlatformMXBean
(
Class
<
T
>
mxbeanInterface
)
{
PlatformComponent
pc
=
PlatformComponent
.
getPlatformComponent
(
mxbeanInterface
);
PlatformComponent
pc
=
PlatformComponent
.
getPlatformComponent
(
mxbeanInterface
);
if
(
pc
==
null
)
if
(
pc
==
null
)
{
T
mbean
=
ExtendedPlatformComponent
.
getMXBean
(
mxbeanInterface
);
if
(
mbean
!=
null
)
{
return
mbean
;
}
throw
new
IllegalArgumentException
(
mxbeanInterface
.
getName
()
+
throw
new
IllegalArgumentException
(
mxbeanInterface
.
getName
()
+
" is not a platform management interface"
);
" is not a platform management interface"
);
}
if
(!
pc
.
isSingleton
())
if
(!
pc
.
isSingleton
())
throw
new
IllegalArgumentException
(
mxbeanInterface
.
getName
()
+
throw
new
IllegalArgumentException
(
mxbeanInterface
.
getName
()
+
" can have zero or more than one instances"
);
" can have zero or more than one instances"
);
...
@@ -690,9 +702,14 @@ public class ManagementFactory {
...
@@ -690,9 +702,14 @@ public class ManagementFactory {
public
static
<
T
extends
PlatformManagedObject
>
List
<
T
>
public
static
<
T
extends
PlatformManagedObject
>
List
<
T
>
getPlatformMXBeans
(
Class
<
T
>
mxbeanInterface
)
{
getPlatformMXBeans
(
Class
<
T
>
mxbeanInterface
)
{
PlatformComponent
pc
=
PlatformComponent
.
getPlatformComponent
(
mxbeanInterface
);
PlatformComponent
pc
=
PlatformComponent
.
getPlatformComponent
(
mxbeanInterface
);
if
(
pc
==
null
)
if
(
pc
==
null
)
{
T
mbean
=
ExtendedPlatformComponent
.
getMXBean
(
mxbeanInterface
);
if
(
mbean
!=
null
)
{
return
Collections
.
singletonList
(
mbean
);
}
throw
new
IllegalArgumentException
(
mxbeanInterface
.
getName
()
+
throw
new
IllegalArgumentException
(
mxbeanInterface
.
getName
()
+
" is not a platform management interface"
);
" is not a platform management interface"
);
}
return
Collections
.
unmodifiableList
(
pc
.
getMXBeans
(
mxbeanInterface
));
return
Collections
.
unmodifiableList
(
pc
.
getMXBeans
(
mxbeanInterface
));
}
}
...
@@ -737,9 +754,17 @@ public class ManagementFactory {
...
@@ -737,9 +754,17 @@ public class ManagementFactory {
throws
java
.
io
.
IOException
throws
java
.
io
.
IOException
{
{
PlatformComponent
pc
=
PlatformComponent
.
getPlatformComponent
(
mxbeanInterface
);
PlatformComponent
pc
=
PlatformComponent
.
getPlatformComponent
(
mxbeanInterface
);
if
(
pc
==
null
)
if
(
pc
==
null
)
{
T
mbean
=
ExtendedPlatformComponent
.
getMXBean
(
mxbeanInterface
);
if
(
mbean
!=
null
)
{
ObjectName
on
=
mbean
.
getObjectName
();
return
ManagementFactory
.
newPlatformMXBeanProxy
(
connection
,
on
.
getCanonicalName
(),
mxbeanInterface
);
}
throw
new
IllegalArgumentException
(
mxbeanInterface
.
getName
()
+
throw
new
IllegalArgumentException
(
mxbeanInterface
.
getName
()
+
" is not a platform management interface"
);
" is not a platform management interface"
);
}
if
(!
pc
.
isSingleton
())
if
(!
pc
.
isSingleton
())
throw
new
IllegalArgumentException
(
mxbeanInterface
.
getName
()
+
throw
new
IllegalArgumentException
(
mxbeanInterface
.
getName
()
+
" can have zero or more than one instances"
);
" can have zero or more than one instances"
);
...
@@ -781,6 +806,13 @@ public class ManagementFactory {
...
@@ -781,6 +806,13 @@ public class ManagementFactory {
{
{
PlatformComponent
pc
=
PlatformComponent
.
getPlatformComponent
(
mxbeanInterface
);
PlatformComponent
pc
=
PlatformComponent
.
getPlatformComponent
(
mxbeanInterface
);
if
(
pc
==
null
)
{
if
(
pc
==
null
)
{
T
mbean
=
ExtendedPlatformComponent
.
getMXBean
(
mxbeanInterface
);
if
(
mbean
!=
null
)
{
ObjectName
on
=
mbean
.
getObjectName
();
T
proxy
=
ManagementFactory
.
newPlatformMXBeanProxy
(
connection
,
on
.
getCanonicalName
(),
mxbeanInterface
);
return
Collections
.
singletonList
(
proxy
);
}
throw
new
IllegalArgumentException
(
mxbeanInterface
.
getName
()
+
throw
new
IllegalArgumentException
(
mxbeanInterface
.
getName
()
+
" is not a platform management interface"
);
" is not a platform management interface"
);
}
}
...
...
src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java
浏览文件 @
0128b684
...
@@ -550,6 +550,7 @@ public class InsnList {
...
@@ -550,6 +550,7 @@ public class InsnList {
}
}
// this class is not generified because it will create bridges
// this class is not generified because it will create bridges
@SuppressWarnings
(
"rawtypes"
)
private
final
class
InsnListIterator
implements
ListIterator
{
private
final
class
InsnListIterator
implements
ListIterator
{
AbstractInsnNode
next
;
AbstractInsnNode
next
;
...
...
src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodNode.java
浏览文件 @
0128b684
...
@@ -399,6 +399,7 @@ public class MethodNode extends MethodVisitor {
...
@@ -399,6 +399,7 @@ public class MethodNode extends MethodVisitor {
}
}
@Override
@Override
@SuppressWarnings
(
"unchecked"
)
public
AnnotationVisitor
visitParameterAnnotation
(
final
int
parameter
,
public
AnnotationVisitor
visitParameterAnnotation
(
final
int
parameter
,
final
String
desc
,
final
boolean
visible
)
{
final
String
desc
,
final
boolean
visible
)
{
AnnotationNode
an
=
new
AnnotationNode
(
desc
);
AnnotationNode
an
=
new
AnnotationNode
(
desc
);
...
...
src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java
浏览文件 @
0128b684
...
@@ -131,6 +131,7 @@ public class Analyzer<V extends Value> implements Opcodes {
...
@@ -131,6 +131,7 @@ public class Analyzer<V extends Value> implements Opcodes {
* @throws AnalyzerException
* @throws AnalyzerException
* if a problem occurs during the analysis.
* if a problem occurs during the analysis.
*/
*/
@SuppressWarnings
(
"unchecked"
)
public
Frame
<
V
>[]
analyze
(
final
String
owner
,
final
MethodNode
m
)
public
Frame
<
V
>[]
analyze
(
final
String
owner
,
final
MethodNode
m
)
throws
AnalyzerException
{
throws
AnalyzerException
{
if
((
m
.
access
&
(
ACC_ABSTRACT
|
ACC_NATIVE
))
!=
0
)
{
if
((
m
.
access
&
(
ACC_ABSTRACT
|
ACC_NATIVE
))
!=
0
)
{
...
...
src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Frame.java
浏览文件 @
0128b684
...
@@ -112,6 +112,7 @@ public class Frame<V extends Value> {
...
@@ -112,6 +112,7 @@ public class Frame<V extends Value> {
* @param nStack
* @param nStack
* the maximum stack size of the frame.
* the maximum stack size of the frame.
*/
*/
@SuppressWarnings
(
"unchecked"
)
public
Frame
(
final
int
nLocals
,
final
int
nStack
)
{
public
Frame
(
final
int
nLocals
,
final
int
nStack
)
{
this
.
values
=
(
V
[])
new
Value
[
nLocals
+
nStack
];
this
.
values
=
(
V
[])
new
Value
[
nLocals
+
nStack
];
this
.
locals
=
nLocals
;
this
.
locals
=
nLocals
;
...
...
src/share/classes/jdk/internal/org/objectweb/asm/version.txt
浏览文件 @
0128b684
Path: .
Path: .
Working Copy Root Path: /hudson/jobs/objectweb-pull/workspace/asm-svn-2014-0
5-27
Working Copy Root Path: /hudson/jobs/objectweb-pull/workspace/asm-svn-2014-0
6-19
URL: file:///svnroot/asm/trunk/asm
URL: file:///svnroot/asm/trunk/asm
Repository Root: file:///svnroot/asm
Repository Root: file:///svnroot/asm
Repository UUID: 271bd773-ee82-43a6-9b2b-1890ed8ce7f9
Repository UUID: 271bd773-ee82-43a6-9b2b-1890ed8ce7f9
Revision: 17
48
Revision: 17
50
Node Kind: directory
Node Kind: directory
Schedule: normal
Schedule: normal
Last Changed Author:
ebruneton
Last Changed Author:
forax
Last Changed Rev: 17
47
Last Changed Rev: 17
50
Last Changed Date: 2014-0
5-24 10:22:13 +0200 (Sat, 24 May
2014)
Last Changed Date: 2014-0
6-06 00:31:02 +0200 (Fri, 06 Jun
2014)
src/share/classes/jdk/net/Sockets.java
浏览文件 @
0128b684
...
@@ -119,6 +119,8 @@ public class Sockets {
...
@@ -119,6 +119,8 @@ public class Sockets {
Throwable
t
=
((
InvocationTargetException
)
e
).
getTargetException
();
Throwable
t
=
((
InvocationTargetException
)
e
).
getTargetException
();
if
(
t
instanceof
IOException
)
{
if
(
t
instanceof
IOException
)
{
throw
(
IOException
)
t
;
throw
(
IOException
)
t
;
}
else
if
(
t
instanceof
RuntimeException
)
{
throw
(
RuntimeException
)
t
;
}
}
}
}
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
...
@@ -135,6 +137,8 @@ public class Sockets {
...
@@ -135,6 +137,8 @@ public class Sockets {
Throwable
t
=
((
InvocationTargetException
)
e
).
getTargetException
();
Throwable
t
=
((
InvocationTargetException
)
e
).
getTargetException
();
if
(
t
instanceof
IOException
)
{
if
(
t
instanceof
IOException
)
{
throw
(
IOException
)
t
;
throw
(
IOException
)
t
;
}
else
if
(
t
instanceof
RuntimeException
)
{
throw
(
RuntimeException
)
t
;
}
}
}
}
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
...
...
src/share/classes/sun/awt/shell/ShellFolder.java
浏览文件 @
0128b684
/*
/*
* Copyright (c) 2000, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
14
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,8 +33,6 @@ import java.io.FileNotFoundException;
...
@@ -33,8 +33,6 @@ import java.io.FileNotFoundException;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.Callable
;
import
sun.reflect.misc.ReflectUtil
;
/**
/**
* @author Michael Martak
* @author Michael Martak
* @since 1.4
* @since 1.4
...
@@ -201,16 +199,19 @@ public abstract class ShellFolder extends File {
...
@@ -201,16 +199,19 @@ public abstract class ShellFolder extends File {
// Static
// Static
private
static
ShellFolderManager
shellFolderManager
;
private
static
final
ShellFolderManager
shellFolderManager
;
private
static
Invoker
invoker
;
private
static
final
Invoker
invoker
;
static
{
static
{
String
managerClassName
=
(
String
)
Toolkit
.
getDefaultToolkit
().
String
managerClassName
=
(
String
)
Toolkit
.
getDefaultToolkit
().
getDesktopProperty
(
"Shell.shellFolderManager"
);
getDesktopProperty
(
"Shell.shellFolderManager"
);
Class
managerClass
=
null
;
Class
managerClass
=
null
;
try
{
try
{
managerClass
=
ReflectUtil
.
forName
(
managerClassName
);
managerClass
=
Class
.
forName
(
managerClassName
,
false
,
null
);
if
(!
ShellFolderManager
.
class
.
isAssignableFrom
(
managerClass
))
{
managerClass
=
null
;
}
// swallow the exceptions below and use default shell folder
// swallow the exceptions below and use default shell folder
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
NullPointerException
e
)
{
}
catch
(
NullPointerException
e
)
{
...
...
src/share/classes/sun/management/ExtendedPlatformComponent.java
0 → 100644
浏览文件 @
0128b684
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
sun.management
;
import
java.util.Collections
;
import
java.util.List
;
import
java.lang.management.PlatformManagedObject
;
/**
* Class to allow for an extended set of platform MXBeans
*/
public
final
class
ExtendedPlatformComponent
{
private
ExtendedPlatformComponent
()
{}
// Don't create any instances
/**
* Get the extended set of platform MXBeans that should be registered in the
* platform MBeanServer, or an empty list if there are no such MXBeans.
*/
public
static
List
<?
extends
PlatformManagedObject
>
getMXBeans
()
{
return
Collections
.
emptyList
();
}
/**
* Returns the extended platform MXBean implementing the given
* mxbeanInterface, or null if there is no such MXBean.
*/
public
static
<
T
extends
PlatformManagedObject
>
T
getMXBean
(
Class
<
T
>
mxbeanInterface
)
{
return
null
;
}
}
src/windows/native/java/io/WinNTFileSystem_md.c
浏览文件 @
0128b684
/*
/*
* Copyright (c) 2001, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -83,7 +83,7 @@ extern int wcanonicalizeWithPrefix(const WCHAR *canonicalPrefix, const WCHAR *pa
...
@@ -83,7 +83,7 @@ extern int wcanonicalizeWithPrefix(const WCHAR *canonicalPrefix, const WCHAR *pa
* Retrieves the fully resolved (final) path for the given path or NULL
* Retrieves the fully resolved (final) path for the given path or NULL
* if the function fails.
* if the function fails.
*/
*/
static
WCHAR
*
getFinalPath
(
const
WCHAR
*
path
)
static
WCHAR
*
getFinalPath
(
JNIEnv
*
env
,
const
WCHAR
*
path
)
{
{
HANDLE
h
;
HANDLE
h
;
WCHAR
*
result
;
WCHAR
*
result
;
...
@@ -119,6 +119,7 @@ static WCHAR* getFinalPath(const WCHAR *path)
...
@@ -119,6 +119,7 @@ static WCHAR* getFinalPath(const WCHAR *path)
len
=
(
*
GetFinalPathNameByHandle_func
)(
h
,
result
,
len
,
0
);
len
=
(
*
GetFinalPathNameByHandle_func
)(
h
,
result
,
len
,
0
);
}
else
{
}
else
{
len
=
0
;
len
=
0
;
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
}
}
}
}
...
@@ -139,6 +140,7 @@ static WCHAR* getFinalPath(const WCHAR *path)
...
@@ -139,6 +140,7 @@ static WCHAR* getFinalPath(const WCHAR *path)
/* copy result without prefix into new buffer */
/* copy result without prefix into new buffer */
WCHAR
*
tmp
=
(
WCHAR
*
)
malloc
(
resultLen
*
sizeof
(
WCHAR
));
WCHAR
*
tmp
=
(
WCHAR
*
)
malloc
(
resultLen
*
sizeof
(
WCHAR
));
if
(
tmp
==
NULL
)
{
if
(
tmp
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
len
=
0
;
len
=
0
;
}
else
{
}
else
{
WCHAR
*
p
=
result
;
WCHAR
*
p
=
result
;
...
@@ -162,6 +164,8 @@ static WCHAR* getFinalPath(const WCHAR *path)
...
@@ -162,6 +164,8 @@ static WCHAR* getFinalPath(const WCHAR *path)
free
(
result
);
free
(
result
);
result
=
NULL
;
result
=
NULL
;
}
}
}
else
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
}
}
error
=
GetLastError
();
error
=
GetLastError
();
...
@@ -255,6 +259,8 @@ Java_java_io_WinNTFileSystem_canonicalize0(JNIEnv *env, jobject this,
...
@@ -255,6 +259,8 @@ Java_java_io_WinNTFileSystem_canonicalize0(JNIEnv *env, jobject this,
rv
=
(
*
env
)
->
NewString
(
env
,
cp
,
(
jsize
)
wcslen
(
cp
));
rv
=
(
*
env
)
->
NewString
(
env
,
cp
,
(
jsize
)
wcslen
(
cp
));
}
}
free
(
cp
);
free
(
cp
);
}
else
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
}
}
}
else
}
else
if
(
wcanonicalize
(
path
,
canonicalPath
,
MAX_PATH_LENGTH
)
>=
0
)
{
if
(
wcanonicalize
(
path
,
canonicalPath
,
MAX_PATH_LENGTH
)
>=
0
)
{
...
@@ -287,6 +293,8 @@ Java_java_io_WinNTFileSystem_canonicalizeWithPrefix0(JNIEnv *env, jobject this,
...
@@ -287,6 +293,8 @@ Java_java_io_WinNTFileSystem_canonicalizeWithPrefix0(JNIEnv *env, jobject this,
rv
=
(
*
env
)
->
NewString
(
env
,
cp
,
(
jsize
)
wcslen
(
cp
));
rv
=
(
*
env
)
->
NewString
(
env
,
cp
,
(
jsize
)
wcslen
(
cp
));
}
}
free
(
cp
);
free
(
cp
);
}
else
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
}
}
}
else
}
else
if
(
wcanonicalizeWithPrefix
(
canonicalPrefix
,
if
(
wcanonicalizeWithPrefix
(
canonicalPrefix
,
...
@@ -434,7 +442,7 @@ Java_java_io_WinNTFileSystem_setPermission(JNIEnv *env, jobject this,
...
@@ -434,7 +442,7 @@ Java_java_io_WinNTFileSystem_setPermission(JNIEnv *env, jobject this,
if
((
a
!=
INVALID_FILE_ATTRIBUTES
)
&&
if
((
a
!=
INVALID_FILE_ATTRIBUTES
)
&&
((
a
&
FILE_ATTRIBUTE_REPARSE_POINT
)
!=
0
))
((
a
&
FILE_ATTRIBUTE_REPARSE_POINT
)
!=
0
))
{
{
WCHAR
*
fp
=
getFinalPath
(
pathbuf
);
WCHAR
*
fp
=
getFinalPath
(
env
,
pathbuf
);
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
{
a
=
INVALID_FILE_ATTRIBUTES
;
a
=
INVALID_FILE_ATTRIBUTES
;
}
else
{
}
else
{
...
@@ -624,6 +632,7 @@ Java_java_io_WinNTFileSystem_list(JNIEnv *env, jobject this, jobject file)
...
@@ -624,6 +632,7 @@ Java_java_io_WinNTFileSystem_list(JNIEnv *env, jobject this, jobject file)
if
(
search_path
==
0
)
{
if
(
search_path
==
0
)
{
free
(
pathbuf
);
free
(
pathbuf
);
errno
=
ENOMEM
;
errno
=
ENOMEM
;
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation faiuled"
);
return
NULL
;
return
NULL
;
}
}
wcscpy
(
search_path
,
pathbuf
);
wcscpy
(
search_path
,
pathbuf
);
...
@@ -801,7 +810,7 @@ Java_java_io_WinNTFileSystem_setReadOnly(JNIEnv *env, jobject this,
...
@@ -801,7 +810,7 @@ Java_java_io_WinNTFileSystem_setReadOnly(JNIEnv *env, jobject this,
if
((
a
!=
INVALID_FILE_ATTRIBUTES
)
&&
if
((
a
!=
INVALID_FILE_ATTRIBUTES
)
&&
((
a
&
FILE_ATTRIBUTE_REPARSE_POINT
)
!=
0
))
((
a
&
FILE_ATTRIBUTE_REPARSE_POINT
)
!=
0
))
{
{
WCHAR
*
fp
=
getFinalPath
(
pathbuf
);
WCHAR
*
fp
=
getFinalPath
(
env
,
pathbuf
);
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
{
a
=
INVALID_FILE_ATTRIBUTES
;
a
=
INVALID_FILE_ATTRIBUTES
;
}
else
{
}
else
{
...
...
src/windows/native/java/io/io_util_md.c
浏览文件 @
0128b684
/*
/*
* Copyright (c) 2001, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -191,9 +191,9 @@ pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE) {
...
@@ -191,9 +191,9 @@ pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE) {
int
dirlen
=
currentDirLength
(
ps
,
pathlen
);
int
dirlen
=
currentDirLength
(
ps
,
pathlen
);
if
(
dirlen
+
pathlen
+
1
>
max_path
-
1
)
{
if
(
dirlen
+
pathlen
+
1
>
max_path
-
1
)
{
pathbuf
=
prefixAbpath
(
ps
,
pathlen
,
dirlen
+
pathlen
);
pathbuf
=
prefixAbpath
(
ps
,
pathlen
,
dirlen
+
pathlen
);
if
(
pathbuf
==
NULL
)
{
if
(
pathbuf
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
return
NULL
;
return
NULL
;
}
}
}
else
{
}
else
{
pathbuf
=
(
WCHAR
*
)
malloc
((
pathlen
+
6
)
*
sizeof
(
WCHAR
));
pathbuf
=
(
WCHAR
*
)
malloc
((
pathlen
+
6
)
*
sizeof
(
WCHAR
));
...
@@ -216,12 +216,17 @@ pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE) {
...
@@ -216,12 +216,17 @@ pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE) {
return
NULL
;
return
NULL
;
}
else
{
}
else
{
pathbuf
=
(
WCHAR
*
)
malloc
(
sizeof
(
WCHAR
));
pathbuf
=
(
WCHAR
*
)
malloc
(
sizeof
(
WCHAR
));
pathbuf
[
0
]
=
L'\0'
;
if
(
pathbuf
!=
NULL
)
{
pathbuf
[
0
]
=
L'\0'
;
}
else
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
return
NULL
;
}
}
}
}
}
if
(
pathbuf
==
0
)
{
if
(
pathbuf
==
0
)
{
if
(
!
(
*
env
)
->
ExceptionCheck
(
env
))
{
if
(
!
(
*
env
)
->
ExceptionCheck
(
env
))
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
}
}
return
NULL
;
return
NULL
;
}
}
...
...
src/windows/native/java/lang/ProcessEnvironment_md.c
浏览文件 @
0128b684
/*
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003,
2014
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -32,10 +32,17 @@ static jstring
...
@@ -32,10 +32,17 @@ static jstring
environmentBlock9x
(
JNIEnv
*
env
)
environmentBlock9x
(
JNIEnv
*
env
)
{
{
int
i
;
int
i
;
jmethodID
String_init_ID
=
jmethodID
String_init_ID
;
(
*
env
)
->
GetMethodID
(
env
,
JNU_ClassString
(
env
),
"<init>"
,
"([B)V"
);
jbyteArray
bytes
;
jbyteArray
bytes
;
jbyte
*
blockA
=
(
jbyte
*
)
GetEnvironmentStringsA
();
jbyte
*
blockA
;
jclass
string_class
;
string_class
=
JNU_ClassString
(
env
);
CHECK_NULL_RETURN
(
string_class
,
NULL
);
String_init_ID
=
(
*
env
)
->
GetMethodID
(
env
,
string_class
,
"<init>"
,
"([B)V"
);
CHECK_NULL_RETURN
(
String_init_ID
,
NULL
);
blockA
=
(
jbyte
*
)
GetEnvironmentStringsA
();
if
(
blockA
==
NULL
)
{
if
(
blockA
==
NULL
)
{
/* Both GetEnvironmentStringsW and GetEnvironmentStringsA
/* Both GetEnvironmentStringsW and GetEnvironmentStringsA
* failed. Out of memory is our best guess. */
* failed. Out of memory is our best guess. */
...
@@ -49,10 +56,13 @@ environmentBlock9x(JNIEnv *env)
...
@@ -49,10 +56,13 @@ environmentBlock9x(JNIEnv *env)
while
(
blockA
[
i
++
])
while
(
blockA
[
i
++
])
;
;
if
((
bytes
=
(
*
env
)
->
NewByteArray
(
env
,
i
))
==
NULL
)
return
NULL
;
if
((
bytes
=
(
*
env
)
->
NewByteArray
(
env
,
i
))
==
NULL
)
{
FreeEnvironmentStringsA
(
blockA
);
return
NULL
;
}
(
*
env
)
->
SetByteArrayRegion
(
env
,
bytes
,
0
,
i
,
blockA
);
(
*
env
)
->
SetByteArrayRegion
(
env
,
bytes
,
0
,
i
,
blockA
);
FreeEnvironmentStringsA
(
blockA
);
FreeEnvironmentStringsA
(
blockA
);
return
(
*
env
)
->
NewObject
(
env
,
JNU_ClassString
(
env
)
,
return
(
*
env
)
->
NewObject
(
env
,
string_class
,
String_init_ID
,
bytes
);
String_init_ID
,
bytes
);
}
}
...
...
src/windows/native/java/lang/ProcessImpl_md.c
浏览文件 @
0128b684
...
@@ -359,24 +359,28 @@ Java_java_lang_ProcessImpl_create(JNIEnv *env, jclass ignored,
...
@@ -359,24 +359,28 @@ Java_java_lang_ProcessImpl_create(JNIEnv *env, jclass ignored,
const
jchar
*
penvBlock
=
(
envBlock
!=
NULL
)
const
jchar
*
penvBlock
=
(
envBlock
!=
NULL
)
?
(
*
env
)
->
GetStringChars
(
env
,
envBlock
,
NULL
)
?
(
*
env
)
->
GetStringChars
(
env
,
envBlock
,
NULL
)
:
NULL
;
:
NULL
;
const
jchar
*
pdir
=
(
dir
!=
NULL
)
if
(
!
(
*
env
)
->
ExceptionCheck
(
env
))
{
?
(
*
env
)
->
GetStringChars
(
env
,
dir
,
NULL
)
const
jchar
*
pdir
=
(
dir
!=
NULL
)
:
NULL
;
?
(
*
env
)
->
GetStringChars
(
env
,
dir
,
NULL
)
jlong
*
handles
=
(
*
env
)
->
GetLongArrayElements
(
env
,
stdHandles
,
NULL
);
:
NULL
;
if
(
handles
!=
NULL
)
{
if
(
!
(
*
env
)
->
ExceptionCheck
(
env
))
{
ret
=
processCreate
(
jlong
*
handles
=
(
*
env
)
->
GetLongArrayElements
(
env
,
stdHandles
,
NULL
);
env
,
if
(
handles
!=
NULL
)
{
pcmd
,
ret
=
processCreate
(
penvBlock
,
env
,
pdir
,
pcmd
,
handles
,
penvBlock
,
redirectErrorStream
);
pdir
,
(
*
env
)
->
ReleaseLongArrayElements
(
env
,
stdHandles
,
handles
,
0
);
handles
,
redirectErrorStream
);
(
*
env
)
->
ReleaseLongArrayElements
(
env
,
stdHandles
,
handles
,
0
);
}
if
(
pdir
!=
NULL
)
(
*
env
)
->
ReleaseStringChars
(
env
,
dir
,
pdir
);
}
if
(
penvBlock
!=
NULL
)
(
*
env
)
->
ReleaseStringChars
(
env
,
envBlock
,
penvBlock
);
}
}
if
(
pdir
!=
NULL
)
(
*
env
)
->
ReleaseStringChars
(
env
,
dir
,
pdir
);
if
(
penvBlock
!=
NULL
)
(
*
env
)
->
ReleaseStringChars
(
env
,
envBlock
,
penvBlock
);
(
*
env
)
->
ReleaseStringChars
(
env
,
cmd
,
pcmd
);
(
*
env
)
->
ReleaseStringChars
(
env
,
cmd
,
pcmd
);
}
}
}
}
...
@@ -448,7 +452,7 @@ Java_java_lang_ProcessImpl_isProcessAlive(JNIEnv *env, jclass ignored, jlong han
...
@@ -448,7 +452,7 @@ Java_java_lang_ProcessImpl_isProcessAlive(JNIEnv *env, jclass ignored, jlong han
JNIEXPORT
jboolean
JNICALL
JNIEXPORT
jboolean
JNICALL
Java_java_lang_ProcessImpl_closeHandle
(
JNIEnv
*
env
,
jclass
ignored
,
jlong
handle
)
Java_java_lang_ProcessImpl_closeHandle
(
JNIEnv
*
env
,
jclass
ignored
,
jlong
handle
)
{
{
return
CloseHandle
((
HANDLE
)
handle
);
return
(
jboolean
)
CloseHandle
((
HANDLE
)
handle
);
}
}
/**
/**
...
...
src/windows/native/java/util/WindowsPreferences.c
浏览文件 @
0128b684
/*
/*
* Copyright (c) 2000, 20
02
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
14
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -24,8 +24,10 @@
...
@@ -24,8 +24,10 @@
*/
*/
#include <stdlib.h>
#include <stdlib.h>
#include <jni.h>
#include <windows.h>
#include <windows.h>
#include "jni.h"
#include "jni_util.h"
#include "jvm.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
...
@@ -37,12 +39,15 @@ extern "C" {
...
@@ -37,12 +39,15 @@ extern "C" {
int
errorCode
=-
1
;
int
errorCode
=-
1
;
jintArray
result
;
jintArray
result
;
str
=
(
*
env
)
->
GetByteArrayElements
(
env
,
lpSubKey
,
NULL
);
str
=
(
*
env
)
->
GetByteArrayElements
(
env
,
lpSubKey
,
NULL
);
CHECK_NULL_RETURN
(
str
,
NULL
);
errorCode
=
RegOpenKeyEx
((
HKEY
)
hKey
,
str
,
0
,
securityMask
,
&
handle
);
errorCode
=
RegOpenKeyEx
((
HKEY
)
hKey
,
str
,
0
,
securityMask
,
&
handle
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
lpSubKey
,
str
,
0
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
lpSubKey
,
str
,
0
);
tmp
[
0
]
=
(
int
)
handle
;
tmp
[
0
]
=
(
int
)
handle
;
tmp
[
1
]
=
errorCode
;
tmp
[
1
]
=
errorCode
;
result
=
(
*
env
)
->
NewIntArray
(
env
,
2
);
result
=
(
*
env
)
->
NewIntArray
(
env
,
2
);
(
*
env
)
->
SetIntArrayRegion
(
env
,
result
,
0
,
2
,
tmp
);
if
(
result
!=
NULL
)
{
(
*
env
)
->
SetIntArrayRegion
(
env
,
result
,
0
,
2
,
tmp
);
}
return
result
;
return
result
;
}
}
...
@@ -58,8 +63,9 @@ extern "C" {
...
@@ -58,8 +63,9 @@ extern "C" {
int
tmp
[
3
];
int
tmp
[
3
];
DWORD
lpdwDisposition
;
DWORD
lpdwDisposition
;
int
errorCode
;
int
errorCode
;
jintArray
result
;
jintArray
result
=
NULL
;
str
=
(
*
env
)
->
GetByteArrayElements
(
env
,
lpSubKey
,
NULL
);
str
=
(
*
env
)
->
GetByteArrayElements
(
env
,
lpSubKey
,
NULL
);
CHECK_NULL_RETURN
(
str
,
NULL
);
errorCode
=
RegCreateKeyEx
((
HKEY
)
hKey
,
str
,
0
,
NULL
,
errorCode
=
RegCreateKeyEx
((
HKEY
)
hKey
,
str
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_READ
,
REG_OPTION_NON_VOLATILE
,
KEY_READ
,
NULL
,
&
handle
,
&
lpdwDisposition
);
NULL
,
&
handle
,
&
lpdwDisposition
);
...
@@ -68,7 +74,9 @@ extern "C" {
...
@@ -68,7 +74,9 @@ extern "C" {
tmp
[
1
]
=
errorCode
;
tmp
[
1
]
=
errorCode
;
tmp
[
2
]
=
lpdwDisposition
;
tmp
[
2
]
=
lpdwDisposition
;
result
=
(
*
env
)
->
NewIntArray
(
env
,
3
);
result
=
(
*
env
)
->
NewIntArray
(
env
,
3
);
(
*
env
)
->
SetIntArrayRegion
(
env
,
result
,
0
,
3
,
tmp
);
if
(
result
!=
NULL
)
{
(
*
env
)
->
SetIntArrayRegion
(
env
,
result
,
0
,
3
,
tmp
);
}
return
result
;
return
result
;
}
}
...
@@ -77,6 +85,7 @@ extern "C" {
...
@@ -77,6 +85,7 @@ extern "C" {
char
*
str
;
char
*
str
;
int
result
;
int
result
;
str
=
(
*
env
)
->
GetByteArrayElements
(
env
,
lpSubKey
,
NULL
);
str
=
(
*
env
)
->
GetByteArrayElements
(
env
,
lpSubKey
,
NULL
);
CHECK_NULL_RETURN
(
str
,
-
1
);
result
=
RegDeleteKey
((
HKEY
)
hKey
,
str
);
result
=
RegDeleteKey
((
HKEY
)
hKey
,
str
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
lpSubKey
,
str
,
0
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
lpSubKey
,
str
,
0
);
return
result
;
return
result
;
...
@@ -96,6 +105,7 @@ extern "C" {
...
@@ -96,6 +105,7 @@ extern "C" {
DWORD
valueType
;
DWORD
valueType
;
DWORD
valueSize
;
DWORD
valueSize
;
valueNameStr
=
(
*
env
)
->
GetByteArrayElements
(
env
,
valueName
,
NULL
);
valueNameStr
=
(
*
env
)
->
GetByteArrayElements
(
env
,
valueName
,
NULL
);
CHECK_NULL_RETURN
(
valueNameStr
,
NULL
);
if
(
RegQueryValueEx
((
HKEY
)
hKey
,
valueNameStr
,
NULL
,
&
valueType
,
NULL
,
if
(
RegQueryValueEx
((
HKEY
)
hKey
,
valueNameStr
,
NULL
,
&
valueType
,
NULL
,
&
valueSize
)
!=
ERROR_SUCCESS
)
{
&
valueSize
)
!=
ERROR_SUCCESS
)
{
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
valueName
,
valueNameStr
,
0
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
valueName
,
valueNameStr
,
0
);
...
@@ -104,18 +114,26 @@ extern "C" {
...
@@ -104,18 +114,26 @@ extern "C" {
buffer
=
(
char
*
)
malloc
(
valueSize
);
buffer
=
(
char
*
)
malloc
(
valueSize
);
if
(
RegQueryValueEx
((
HKEY
)
hKey
,
valueNameStr
,
NULL
,
&
valueType
,
buffer
,
if
(
buffer
!=
NULL
)
{
&
valueSize
)
!=
ERROR_SUCCESS
)
{
if
(
RegQueryValueEx
((
HKEY
)
hKey
,
valueNameStr
,
NULL
,
&
valueType
,
buffer
,
free
(
buffer
);
&
valueSize
)
!=
ERROR_SUCCESS
)
{
free
(
buffer
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
valueName
,
valueNameStr
,
0
);
return
NULL
;
}
}
else
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
valueName
,
valueNameStr
,
0
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
valueName
,
valueNameStr
,
0
);
return
NULL
;
return
NULL
;
}
}
if
(
valueType
==
REG_SZ
)
{
if
(
valueType
==
REG_SZ
)
{
result
=
(
*
env
)
->
NewByteArray
(
env
,
valueSize
);
result
=
(
*
env
)
->
NewByteArray
(
env
,
valueSize
);
(
*
env
)
->
SetByteArrayRegion
(
env
,
result
,
0
,
valueSize
,
buffer
);
if
(
result
!=
NULL
)
{
(
*
env
)
->
SetByteArrayRegion
(
env
,
result
,
0
,
valueSize
,
buffer
);
}
}
else
{
}
else
{
result
=
NULL
;
result
=
NULL
;
}
}
free
(
buffer
);
free
(
buffer
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
valueName
,
valueNameStr
,
0
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
valueName
,
valueNameStr
,
0
);
...
@@ -135,7 +153,9 @@ extern "C" {
...
@@ -135,7 +153,9 @@ extern "C" {
if
((
valueName
==
NULL
)
||
(
data
==
NULL
))
{
return
-
1
;}
if
((
valueName
==
NULL
)
||
(
data
==
NULL
))
{
return
-
1
;}
size
=
(
*
env
)
->
GetArrayLength
(
env
,
data
);
size
=
(
*
env
)
->
GetArrayLength
(
env
,
data
);
dataStr
=
(
*
env
)
->
GetByteArrayElements
(
env
,
data
,
NULL
);
dataStr
=
(
*
env
)
->
GetByteArrayElements
(
env
,
data
,
NULL
);
CHECK_NULL_RETURN
(
dataStr
,
-
1
);
valueNameStr
=
(
*
env
)
->
GetByteArrayElements
(
env
,
valueName
,
NULL
);
valueNameStr
=
(
*
env
)
->
GetByteArrayElements
(
env
,
valueName
,
NULL
);
CHECK_NULL_RETURN
(
valueNameStr
,
-
1
);
error_code
=
RegSetValueEx
((
HKEY
)
hKey
,
valueNameStr
,
0
,
error_code
=
RegSetValueEx
((
HKEY
)
hKey
,
valueNameStr
,
0
,
REG_SZ
,
dataStr
,
size
);
REG_SZ
,
dataStr
,
size
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
data
,
dataStr
,
0
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
data
,
dataStr
,
0
);
...
@@ -149,6 +169,7 @@ extern "C" {
...
@@ -149,6 +169,7 @@ extern "C" {
int
error_code
=
-
1
;
int
error_code
=
-
1
;
if
(
valueName
==
NULL
)
{
return
-
1
;}
if
(
valueName
==
NULL
)
{
return
-
1
;}
valueNameStr
=
(
*
env
)
->
GetByteArrayElements
(
env
,
valueName
,
NULL
);
valueNameStr
=
(
*
env
)
->
GetByteArrayElements
(
env
,
valueName
,
NULL
);
CHECK_NULL_RETURN
(
valueNameStr
,
-
1
);
error_code
=
RegDeleteValue
((
HKEY
)
hKey
,
valueNameStr
);
error_code
=
RegDeleteValue
((
HKEY
)
hKey
,
valueNameStr
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
valueName
,
valueNameStr
,
0
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
valueName
,
valueNameStr
,
0
);
return
error_code
;
return
error_code
;
...
@@ -156,7 +177,7 @@ extern "C" {
...
@@ -156,7 +177,7 @@ extern "C" {
JNIEXPORT
jintArray
JNICALL
Java_java_util_prefs_WindowsPreferences_WindowsRegQueryInfoKey
JNIEXPORT
jintArray
JNICALL
Java_java_util_prefs_WindowsPreferences_WindowsRegQueryInfoKey
(
JNIEnv
*
env
,
jclass
this_class
,
jint
hKey
)
{
(
JNIEnv
*
env
,
jclass
this_class
,
jint
hKey
)
{
jintArray
result
;
jintArray
result
=
NULL
;
int
tmp
[
5
];
int
tmp
[
5
];
int
valuesNumber
=
-
1
;
int
valuesNumber
=
-
1
;
int
maxValueNameLength
=
-
1
;
int
maxValueNameLength
=
-
1
;
...
@@ -173,7 +194,9 @@ extern "C" {
...
@@ -173,7 +194,9 @@ extern "C" {
tmp
[
3
]
=
maxSubKeyLength
;
tmp
[
3
]
=
maxSubKeyLength
;
tmp
[
4
]
=
maxValueNameLength
;
tmp
[
4
]
=
maxValueNameLength
;
result
=
(
*
env
)
->
NewIntArray
(
env
,
5
);
result
=
(
*
env
)
->
NewIntArray
(
env
,
5
);
(
*
env
)
->
SetIntArrayRegion
(
env
,
result
,
0
,
5
,
tmp
);
if
(
result
!=
NULL
)
{
(
*
env
)
->
SetIntArrayRegion
(
env
,
result
,
0
,
5
,
tmp
);
}
return
result
;
return
result
;
}
}
...
@@ -183,13 +206,19 @@ extern "C" {
...
@@ -183,13 +206,19 @@ extern "C" {
jbyteArray
result
;
jbyteArray
result
;
char
*
buffer
=
NULL
;
char
*
buffer
=
NULL
;
buffer
=
(
char
*
)
malloc
(
maxKeyLength
);
buffer
=
(
char
*
)
malloc
(
maxKeyLength
);
if
(
buffer
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
return
NULL
;
}
if
(
RegEnumKeyEx
((
HKEY
)
hKey
,
subKeyIndex
,
buffer
,
&
size
,
NULL
,
NULL
,
if
(
RegEnumKeyEx
((
HKEY
)
hKey
,
subKeyIndex
,
buffer
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
)
!=
ERROR_SUCCESS
){
NULL
,
NULL
)
!=
ERROR_SUCCESS
){
free
(
buffer
);
free
(
buffer
);
return
NULL
;
return
NULL
;
}
}
result
=
(
*
env
)
->
NewByteArray
(
env
,
size
+
1
);
result
=
(
*
env
)
->
NewByteArray
(
env
,
size
+
1
);
(
*
env
)
->
SetByteArrayRegion
(
env
,
result
,
0
,
size
+
1
,
buffer
);
if
(
result
!=
NULL
)
{
(
*
env
)
->
SetByteArrayRegion
(
env
,
result
,
0
,
size
+
1
,
buffer
);
}
free
(
buffer
);
free
(
buffer
);
return
result
;
return
result
;
}
}
...
@@ -201,6 +230,10 @@ extern "C" {
...
@@ -201,6 +230,10 @@ extern "C" {
char
*
buffer
=
NULL
;
char
*
buffer
=
NULL
;
int
error_code
;
int
error_code
;
buffer
=
(
char
*
)
malloc
(
maxValueNameLength
);
buffer
=
(
char
*
)
malloc
(
maxValueNameLength
);
if
(
buffer
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
return
NULL
;
}
error_code
=
RegEnumValue
((
HKEY
)
hKey
,
valueIndex
,
buffer
,
error_code
=
RegEnumValue
((
HKEY
)
hKey
,
valueIndex
,
buffer
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
);
&
size
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
error_code
!=
ERROR_SUCCESS
){
if
(
error_code
!=
ERROR_SUCCESS
){
...
@@ -208,7 +241,9 @@ extern "C" {
...
@@ -208,7 +241,9 @@ extern "C" {
return
NULL
;
return
NULL
;
}
}
result
=
(
*
env
)
->
NewByteArray
(
env
,
size
+
1
);
result
=
(
*
env
)
->
NewByteArray
(
env
,
size
+
1
);
(
*
env
)
->
SetByteArrayRegion
(
env
,
result
,
0
,
size
+
1
,
buffer
);
if
(
result
!=
NULL
)
{
(
*
env
)
->
SetByteArrayRegion
(
env
,
result
,
0
,
size
+
1
,
buffer
);
}
free
(
buffer
);
free
(
buffer
);
return
result
;
return
result
;
}
}
...
...
src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c
浏览文件 @
0128b684
...
@@ -53,7 +53,9 @@ JNIEXPORT void JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_init
...
@@ -53,7 +53,9 @@ JNIEXPORT void JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_init
(
JNIEnv
*
env
,
jclass
authseq_clazz
,
jclass
status_clazz
)
(
JNIEnv
*
env
,
jclass
authseq_clazz
,
jclass
status_clazz
)
{
{
ntlm_ctxHandleID
=
(
*
env
)
->
GetFieldID
(
env
,
authseq_clazz
,
"ctxHandle"
,
"J"
);
ntlm_ctxHandleID
=
(
*
env
)
->
GetFieldID
(
env
,
authseq_clazz
,
"ctxHandle"
,
"J"
);
CHECK_NULL
(
ntlm_ctxHandleID
);
ntlm_crdHandleID
=
(
*
env
)
->
GetFieldID
(
env
,
authseq_clazz
,
"crdHandle"
,
"J"
);
ntlm_crdHandleID
=
(
*
env
)
->
GetFieldID
(
env
,
authseq_clazz
,
"crdHandle"
,
"J"
);
CHECK_NULL
(
ntlm_crdHandleID
);
status_seqCompleteID
=
(
*
env
)
->
GetFieldID
(
env
,
status_clazz
,
"sequenceComplete"
,
"Z"
);
status_seqCompleteID
=
(
*
env
)
->
GetFieldID
(
env
,
status_clazz
,
"sequenceComplete"
,
"Z"
);
}
}
...
@@ -100,6 +102,16 @@ JNIEXPORT jlong JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_get
...
@@ -100,6 +102,16 @@ JNIEXPORT jlong JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_get
}
}
}
}
pCred
=
(
CredHandle
*
)
malloc
(
sizeof
(
CredHandle
));
pCred
=
(
CredHandle
*
)
malloc
(
sizeof
(
CredHandle
));
if
(
pCred
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
if
(
pUser
!=
NULL
)
JNU_ReleaseStringPlatformChars
(
env
,
user
,
pUser
);
if
(
pPassword
!=
NULL
)
JNU_ReleaseStringPlatformChars
(
env
,
password
,
pPassword
);
if
(
pDomain
!=
NULL
)
JNU_ReleaseStringPlatformChars
(
env
,
domain
,
pDomain
);
return
NULL
;
}
if
(
((
pUser
!=
NULL
)
||
(
pPassword
!=
NULL
))
||
(
pDomain
!=
NULL
))
{
if
(
((
pUser
!=
NULL
)
||
(
pPassword
!=
NULL
))
||
(
pDomain
!=
NULL
))
{
pAuthId
=
&
AuthId
;
pAuthId
=
&
AuthId
;
...
@@ -177,7 +189,12 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc
...
@@ -177,7 +189,12 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc
pCtx
=
(
CtxtHandle
*
)
(
*
env
)
->
GetLongField
(
env
,
this
,
ntlm_ctxHandleID
);
pCtx
=
(
CtxtHandle
*
)
(
*
env
)
->
GetLongField
(
env
,
this
,
ntlm_ctxHandleID
);
if
(
pCtx
==
0
)
{
/* first call */
if
(
pCtx
==
0
)
{
/* first call */
newContext
=
(
CtxtHandle
*
)
malloc
(
sizeof
(
CtxtHandle
));
newContext
=
(
CtxtHandle
*
)
malloc
(
sizeof
(
CtxtHandle
));
(
*
env
)
->
SetLongField
(
env
,
this
,
ntlm_ctxHandleID
,
(
jlong
)
newContext
);
if
(
newContext
!=
NULL
)
{
(
*
env
)
->
SetLongField
(
env
,
this
,
ntlm_ctxHandleID
,
(
jlong
)
newContext
);
}
else
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
return
NULL
;
}
}
else
{
}
else
{
newContext
=
pCtx
;
newContext
=
pCtx
;
}
}
...
@@ -198,6 +215,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc
...
@@ -198,6 +215,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc
if
(
lastToken
!=
0
)
if
(
lastToken
!=
0
)
{
{
pInput
=
(
VOID
*
)(
*
env
)
->
GetByteArrayElements
(
env
,
lastToken
,
&
isCopy
);
pInput
=
(
VOID
*
)(
*
env
)
->
GetByteArrayElements
(
env
,
lastToken
,
&
isCopy
);
CHECK_NULL_RETURN
(
pInput
,
NULL
);
inputLen
=
(
*
env
)
->
GetArrayLength
(
env
,
lastToken
);
inputLen
=
(
*
env
)
->
GetArrayLength
(
env
,
lastToken
);
InBuffDesc
.
ulVersion
=
0
;
InBuffDesc
.
ulVersion
=
0
;
...
@@ -240,8 +258,10 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc
...
@@ -240,8 +258,10 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc
if
(
OutSecBuff
.
cbBuffer
>
0
)
{
if
(
OutSecBuff
.
cbBuffer
>
0
)
{
jbyteArray
ret
=
(
*
env
)
->
NewByteArray
(
env
,
OutSecBuff
.
cbBuffer
);
jbyteArray
ret
=
(
*
env
)
->
NewByteArray
(
env
,
OutSecBuff
.
cbBuffer
);
(
*
env
)
->
SetByteArrayRegion
(
env
,
ret
,
0
,
OutSecBuff
.
cbBuffer
,
if
(
ret
!=
NULL
)
{
OutSecBuff
.
pvBuffer
);
(
*
env
)
->
SetByteArrayRegion
(
env
,
ret
,
0
,
OutSecBuff
.
cbBuffer
,
OutSecBuff
.
pvBuffer
);
}
if
(
lastToken
!=
0
)
// 2nd stage
if
(
lastToken
!=
0
)
// 2nd stage
endSequence
(
pCred
,
pCtx
,
env
,
status
);
endSequence
(
pCred
,
pCtx
,
env
,
status
);
result
=
ret
;
result
=
ret
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录