< prev index next >

src/java.base/windows/native/libjava/WinNTFileSystem_md.c

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2001, 2015, 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 --- 1,7 ---- /* ! * Copyright (c) 2001, 2016, 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
*** 885,889 **** --- 885,928 ---- } free(pathbuf); return rv; } + + // pathname is expected to be either null or to contain the root + // of the path terminated by a backslash + JNIEXPORT jlong JNICALL + Java_java_io_WinNTFileSystem_getNameMax0(JNIEnv *env, jobject this, + jstring pathname) + { + BOOL res = 0; + DWORD maxComponentLength; + + if (pathname == NULL) { + res = GetVolumeInformationW(NULL, + NULL, + 0, + NULL, + &maxComponentLength, + NULL, + NULL, + 0); + } else { + WITH_UNICODE_STRING(env, pathname, path) { + res = GetVolumeInformationW(path, + NULL, + 0, + NULL, + &maxComponentLength, + NULL, + NULL, + 0); + } END_UNICODE_STRING(env, path); + } + + if (res == 0) { + JNU_ThrowIOExceptionWithLastError(env, + "Could not get maximum compnent length"); + } + + return (jlong)maxComponentLength; + }
< prev index next >