*** empty log message ***
diff --git a/update/org.eclipse.update.core/Native Code/win32/build.xml b/update/org.eclipse.update.core/Native Code/win32/build.xml index c3f41c9..dc9261c 100644 --- a/update/org.eclipse.update.core/Native Code/win32/build.xml +++ b/update/org.eclipse.update.core/Native Code/win32/build.xml
@@ -3,7 +3,7 @@ <!-- The properties ${eclipse-home} ${jdk-path} should be passed into this script --> <!-- Set a meaningful default value for when it is not. --> - <property name="eclipse-home" value="${basedir}/../.."/> + <property name="eclipse-home" value="${basedir}/../../.."/> <property name="jdk-path" value="${java.home}"/> <property name="destination" value="${eclipse-home}/org.eclipse.update.core/os/win32/"/> <property name="obj-path" value="${eclipse-home}/org.eclipse.update.core/Native Code/"/>
diff --git a/update/org.eclipse.update.core/Native Code/win32/library/update.cpp b/update/org.eclipse.update.core/Native Code/win32/library/update.cpp index b4b9018..f815667 100644 --- a/update/org.eclipse.update.core/Native Code/win32/library/update.cpp +++ b/update/org.eclipse.update.core/Native Code/win32/library/update.cpp
@@ -6,12 +6,175 @@ # include <update.h> # include <windows.h> +# include <winioctl.h> // IOCTL codes: MediaType + +// Windows Version +int WIN98 = 0; +int WINNT = 1; +int WINME = 2; +int WIN2000 = 3; +int WINXP = 4; + +// FLOPPY +int FLOPPY_3 = 0; +int FLOPPY_5 = 1; + +int DEBUG = 0; + typedef BOOL(WINAPI * P_GDFSE) (LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); +// GLOBAL METHODS +// --------------- + + +/* + * calls GetVolumeInformation + */ +jstring getLabel(char driveLetter[],JNIEnv * jnienv){ + + jstring result = NULL; + char buf[128]; + + int err = GetVolumeInformation( + driveLetter, + buf, + sizeof(buf) - 1, + NULL, + NULL, + NULL, + NULL, + 0); + if (err){ + result = jnienv -> NewStringUTF(buf); + } + return result; +} + +/* + * returns the Version of Windows + * int 0 WIN98; + * int 1 WINNT; + * int 2 WINME; + * int 3 WIN2000; + * int 4 WINXP; + * returns -1 otherwise + */ +int getWindowsVersion(){ + OSVERSIONINFOEX osvi; + int UNKNOWN = -1; + + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + + if(!(GetVersionEx((OSVERSIONINFO *)&osvi))){ + if (DEBUG) + printf("UNKNOWN VERSION: Cannot execute GetVersionEx\n"); + return UNKNOWN; + } + + switch(osvi.dwPlatformId){ + case VER_PLATFORM_WIN32_NT: + if (DEBUG) + printf("VERSION NT: Maj %i Min %i\n",osvi.dwMajorVersion,osvi.dwMinorVersion); + if(osvi.dwMajorVersion<=4) + return WINNT; + if(osvi.dwMajorVersion==5){ + if (osvi.dwMinorVersion==0) + return WIN2000; + if (osvi.dwMinorVersion==1) + return WINXP; + } else { + return UNKNOWN; + }; + break; + case VER_PLATFORM_WIN32_WINDOWS: + if (DEBUG) + printf("VERSION Non NT: Maj %i Min %i\n",osvi.dwMajorVersion,osvi.dwMinorVersion); + if(osvi.dwMajorVersion==4){ + if (osvi.dwMinorVersion==10) + return WIN98; + if (osvi.dwMinorVersion==90) + return WINME; + } else { + return UNKNOWN; + } + break; + default: + if (DEBUG) + printf("VERSION UNKNOWN: Maj %i Min %i\n",osvi.dwMajorVersion,osvi.dwMinorVersion); + return UNKNOWN; + } +} + +/* + * Returns the size of the Drive as a label + * Returns FLOPPY_3,FLOPPY_5 or -1 if Not found + */ +int getFloppy(char driveLetter[]){ + + TCHAR floppyPath[8]; + HANDLE handle; + DISK_GEOMETRY geometry[20]; + DWORD dw; + int UNKNOWN = -1; + + if ((int)getWindowsVersion()<0){ + // windows 95 or other + return UNKNOWN; + } else { + sprintf(floppyPath, "\\\\.\\%c:", driveLetter[0]); + if (DEBUG) + printf("Path %s\n",floppyPath); + handle=CreateFile(floppyPath, + 0,FILE_SHARE_WRITE,0,OPEN_EXISTING,0,0); + if (handle==INVALID_HANDLE_VALUE){ + if (DEBUG) + printf("Invalid Handle %s\n",floppyPath); + return UNKNOWN; + } else { + if(DeviceIoControl(handle, + IOCTL_DISK_GET_MEDIA_TYPES,0,0, + geometry,sizeof(geometry),&dw,0) + && dw>0) { + switch(geometry[0].MediaType){ + case F5_160_512: + case F5_180_512: + case F5_320_512: + case F5_320_1024: + case F5_360_512: + case F5_1Pt2_512: + if (DEBUG) + printf("Found 5 1/4 Drive\n"); + return FLOPPY_5; + case F3_720_512: + case F3_1Pt44_512: + case F3_2Pt88_512: + case F3_20Pt8_512: + if (DEBUG) + printf("Found 3 1/2 Drive\n"); + return FLOPPY_3; + } + } + } + } + return UNKNOWN; +} + +/* + * + */ + char[] getRemoteNetworkName(char driveLetter[],JNIEnv * jnienv){ + + } + + +// JNI METHODS +// --------------- + /* * Class: org_eclipse_update_configuration_LocalSystemInfo * Method: nativeGetFreeSpace @@ -97,29 +260,36 @@ obj = jnienv -> CallObjectMethod(file, id); lpDirectoryName = jnienv -> GetStringUTFChars((jstring) obj, 0); + // jstring result = NULL; + int floppy; + // Make sure we have a String of the Form: <letter>: if (':' == lpDirectoryName[1]) { char driveLetter[4]; // i.e. -> C:\\ - char buf[128]; memcpy(driveLetter, lpDirectoryName, 2); strcpy(driveLetter + 2, "\\"); - - /* - * Get the volume name. - */ - int err = GetVolumeInformation( - driveLetter, - buf, - sizeof(buf) - 1, - NULL, - NULL, - NULL, - NULL, - 0); - if (err){ - result = jnienv -> NewStringUTF(buf); - } + switch (GetDriveType(driveLetter)) { + case DRIVE_REMOVABLE : + // check 3.5 or 5.25 + if (DEBUG) + printf("Floppy Drive"); + floppy = getFloppy(driveLetter); + if (floppy==FLOPPY_3) return jnienv -> NewStringUTF("3 1/2"); + if (floppy==FLOPPY_5) return jnienv -> NewStringUTF("5 1/4"); + return NULL; + case DRIVE_REMOTE : + // check name of machine and path of remote + if (DEBUG) + printf("Remote Drive"); + result = getLabel(driveLetter,jnienv); + break; + default : + if (DEBUG) + printf("Another Drive at %s", driveLetter); + result = getLabel(driveLetter,jnienv); + break; + } } return result; @@ -230,4 +400,5 @@ } return returnArray; -} \ No newline at end of file +} +
diff --git a/update/org.eclipse.update.core/Native Code/win32/update.obj b/update/org.eclipse.update.core/Native Code/win32/update.obj new file mode 100644 index 0000000..74c4fe9 --- /dev/null +++ b/update/org.eclipse.update.core/Native Code/win32/update.obj Binary files differ
diff --git a/update/org.eclipse.update.core/Native Code/win32/update.tds b/update/org.eclipse.update.core/Native Code/win32/update.tds new file mode 100644 index 0000000..07b2660 --- /dev/null +++ b/update/org.eclipse.update.core/Native Code/win32/update.tds Binary files differ
diff --git a/update/org.eclipse.update.core/os/win32/update.dll b/update/org.eclipse.update.core/os/win32/update.dll index 33d1d7a..ce73298 100644 --- a/update/org.eclipse.update.core/os/win32/update.dll +++ b/update/org.eclipse.update.core/os/win32/update.dll Binary files differ
diff --git a/update/org.eclipse.update.core/plugin.xml b/update/org.eclipse.update.core/plugin.xml index fcfc5dc..cdc44fa 100644 --- a/update/org.eclipse.update.core/plugin.xml +++ b/update/org.eclipse.update.core/plugin.xml
@@ -2,7 +2,7 @@ <plugin id="org.eclipse.update.core" name="%name" - version="2.0.0" + version="1.9.0" provider-name="%provider-name" class="org.eclipse.update.internal.core.UpdateManagerPlugin">