BOOL WPS_WPClass (PWPS_WPCLASS CustomPtr) { CHAR DLLName[MAXFILELENGTH]; ULONG CRC32; PMINSTFILE CurFilePtr; if (FILE_IncludesPath(CustomPtr->WPDllName)) { strcpy (DLLName, CustomPtr->WPDllName); } else { // If DLL-Name doesnt contain path already, we search for the file in // filelist and add the corresponding path. strlwr (CustomPtr->WPDllName); FILE_SetDefaultExtension (CustomPtr->WPDllName, MINSTMAX_PATHLENGTH, ".dll"); CRC32 = CRC32_GetFromPSZ(CustomPtr->WPDllName); if ((CurFilePtr = MINSTALL_SearchFileCRC32(CRC32))!=0) { if (!STRING_CombinePSZ (DLLName, MAXFILELENGTH, CurFilePtr->DestinPtr->FQName, CustomPtr->WPDllName)) return FALSE; // buffer-overflow } else { strcpy (DLLName, CustomPtr->WPDllName); } } // Register the class at any time... if (!WinRegisterObjectClass (CustomPtr->WPClassNameNew, DLLName)) return FALSE; if (strlen(CustomPtr->WPReplaceClass)>0) { // If Replace-Class set, replace this class with the new one... if (!WinReplaceObjectClass (CustomPtr->WPReplaceClass, CustomPtr->WPClassNameNew, TRUE)) return FALSE; } return TRUE; }
BOOL uninstall(char *newclass, char *oldclass) { if (WinReplaceObjectClass(oldclass,newclass,FALSE) && WinDeregisterObjectClass(newclass)) { printf("%s successfully unregistered.\n",newclass); return TRUE; } else { printf("%s NOT successfully unregistered.\n",newclass); return FALSE; } }
BOOL install(char *dll, char *newclass, char *oldclass) { if (WinRegisterObjectClass(newclass,dll) && WinReplaceObjectClass(oldclass,newclass,TRUE)) { printf("%s successfully registered and %s successfully subclassed.\n",newclass,oldclass); return TRUE; } else { printf("%s NOT successfully subclassed.\n",oldclass); return FALSE; } }