equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
885 } |
885 } |
886 |
886 |
887 free(pathbuf); |
887 free(pathbuf); |
888 return rv; |
888 return rv; |
889 } |
889 } |
|
890 |
|
891 // pathname is expected to be either null or to contain the root |
|
892 // of the path terminated by a backslash |
|
893 JNIEXPORT jint JNICALL |
|
894 Java_java_io_WinNTFileSystem_getNameMax0(JNIEnv *env, jobject this, |
|
895 jstring pathname) |
|
896 { |
|
897 BOOL res = 0; |
|
898 DWORD maxComponentLength; |
|
899 |
|
900 if (pathname == NULL) { |
|
901 res = GetVolumeInformationW(NULL, |
|
902 NULL, |
|
903 0, |
|
904 NULL, |
|
905 &maxComponentLength, |
|
906 NULL, |
|
907 NULL, |
|
908 0); |
|
909 } else { |
|
910 WITH_UNICODE_STRING(env, pathname, path) { |
|
911 res = GetVolumeInformationW(path, |
|
912 NULL, |
|
913 0, |
|
914 NULL, |
|
915 &maxComponentLength, |
|
916 NULL, |
|
917 NULL, |
|
918 0); |
|
919 } END_UNICODE_STRING(env, path); |
|
920 } |
|
921 |
|
922 if (res == 0) { |
|
923 JNU_ThrowIOExceptionWithLastError(env, |
|
924 "Could not get maximum component length"); |
|
925 } |
|
926 |
|
927 return (jint)maxComponentLength; |
|
928 } |