pcdata->num_exts = 0; pcdata->exts = (char **)XP_ALLOC(sizeof(char *));
pcdata->num_exts = numExts; pcdata->exts = (char **)XP_ALLOC(numExts*sizeof(char *));
fe_NewFileType(LPCSTR lpszDescription,			   LPCSTR lpszExtension,			   LPCSTR lpszMimeType,			   LPCSTR lpszOpenCmd){	char	szExtKey[_MAX_PATH];	CString	strFileClass;	HKEY	hKey;#ifdef _WIN32    BOOL    bAlreadyHasMimeType;#endif	// Create a key for the file type extension. There may already be a key for	// this extension; that's okay this will open it	wsprintf(szExtKey, ".%s", lpszExtension);	if (RegCreateKey(HKEY_CLASSES_ROOT, szExtKey, &hKey) != ERROR_SUCCESS)        return NULL;	// Set the file type class associated with the extension. Note that we ONLY	// do this if there is no file type class. If there's already a file type class	// we assume that we're just adding another MIME type for this file type	if (!GetClassName(lpszExtension, strFileClass)) {		// Create a file type class		strFileClass = lpszExtension;		strFileClass += "file";			// Set the file type class		RegSetValue(hKey, NULL, REG_SZ, (LPCSTR)strFileClass, strFileClass.GetLength());	}#ifdef _WIN32	// Add the Content Type for the extension. Only do this if there isn't already a	// content type specified for the extension. Note: unfortunately Microsoft only	// allows a single content type for a particular extension. If there's already a	// content type that's okay, we'll add the additional content type to the MIME database	LONG	lResult;	DWORD	cbData;	ASSERT(lpszMimeType);	cbData = 0;	lResult = RegQueryValueEx(hKey, "Content Type", NULL, NULL, NULL, &cbData);    bAlreadyHasMimeType = (lResult == ERROR_SUCCESS && cbData > 1);	if (!bAlreadyHasMimeType)		RegSetValueEx(hKey, "Content Type", 0, REG_SZ, (CONST BYTE *)lpszMimeType, lstrlen(lpszMimeType) + 1);#endif	RegCloseKey(hKey);	// Create a key for the file type class. If there's already a key this will open	// it	RegCreateKey(HKEY_CLASSES_ROOT, (LPCSTR)strFileClass, &hKey);	// Set the description	RegSetValue(hKey, NULL, REG_SZ, lpszDescription, lstrlen(lpszDescription));	RegCloseKey(hKey);	// Add the shell Open command	SetShellOpenCommand((LPCSTR)strFileClass, lpszOpenCmd);	// Update the MIME database information#ifdef _WIN32	AddToMIMEDatabase(lpszMimeType, szExtKey);		// If there's already a MIME type and we're adding an additional type, then	// add it to the Netscape specific information in the Suffixes section	if (bAlreadyHasMimeType)		AddNetscapeMimeType(lpszMimeType, szExtKey);#else	AddNetscapeMimeType(lpszMimeType, szExtKey);#endif	// Create the NET_cdataStruct structure and associated CHelperApp object    NET_cdataStruct *pcdata = NET_cdataCreate();    if (pcdata) {        pcdata->ci.desc = XP_STRDUP(lpszDescription);        pcdata->ci.type = XP_STRDUP(lpszMimeType);        pcdata->num_exts = 0;        pcdata->exts = (char **)XP_ALLOC(sizeof(char *));        if (pcdata->exts) {            pcdata->exts[0] = XP_STRDUP(lpszExtension);                        if (pcdata->exts[0]) {                pcdata->num_exts = 1;            } else {                XP_FREE(pcdata->exts);                pcdata->exts = 0;            }        }        // Add it to the netlib list        NET_cdataAdd(pcdata);        // Create the front-end data structure        CHelperApp *pApp = new CHelperApp;        if (pApp) {			// Initialize the object            pApp->bChanged = FALSE;            pApp->bNewType = FALSE;            pApp->bChangedExts = FALSE;            pApp->how_handle = HANDLE_SHELLEXECUTE;            pApp->csCmd = MIME_SHELLEXECUTE;			pApp->strFileClass = strFileClass;			// Front-end and netlib data structures need to point to each other	        pApp->cd_item = pcdata;	        pcdata->ci.fe_data = (void *)pApp;			// Store it in the global list ordered by MIME type	        theApp.m_HelperListByType.SetAt(pcdata->ci.type, pApp);        }    }	return pcdata;}