Ignore:
Timestamp:
Oct 7, 2023, 10:41:00 PM (2 years ago)
Author:
erdmann
Message:

rework the way the MMCDTrack class object is loaded: we cannot load it via dynamic linking because CWMM.DLL is not on libpath. Therefore, on class construction of CWMediaFolder, we query the location of class library for class MMCDTrack dynamically (find CWMM.DLL) and then have the class object for MMCDTrack constructed and saved in a member variable of CWMediaFolder

Location:
branches/v2.9_Lars/mediafolder/c
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/v2.9_Lars/mediafolder/c/helper/launchpad.cpp

    r117 r119  
    269269  if (DrgAccessDraginfo(pDragInfo)) {
    270270      PDRAGITEM pDragItem = NULL;
     271      M_CWMediaFolder *mediaFolderClass = NULL;
    271272
    272273        /* Get number of items */
     
    292293      */
    293294      wpObject = (WPObject *)OBJECT_FROM_PREC(pDragItem->ulItemID);
    294       if (!somIsObj(wpObject) || wpObject->somIsA(MMCDTrack::__ClassObject)) {
     295      mediaFolderClass = (M_CWMediaFolder *)CWMediaFolder::__ClassObject;
     296      if (!somIsObj(wpObject) || wpObject->somIsA(mediaFolderClass->MMCDTrackClass)) {
    295297         usIndicator = DOR_NEVERDROP;
    296298         usOp = 0;
  • branches/v2.9_Lars/mediafolder/c/mediafldr/mediafolderoverridenwpclsmethods.cpp

    r47 r119  
    11/*
    22 * This file is (C) Chris Wohlgemuth 1999-2003
    3  * 
     3 *
    44 * It's part of the Audio/Data-CD-Creator distribution
    55 */
     
    132132
    133133  hps=WinGetPS(HWND_DESKTOP);
    134  
     134
    135135  /* The main BMP */
    136136  allBMPs[MAIN_BMP_IDX].hbm=GpiLoadBitmap(hps, hResource, IDBMP_TOPMIDDLE, 0, 0);
     
    352352          if(DosQueryModuleHandle(pathname,&hmod)) {
    353353            pathname=((WPClassManager*)SOMClassMgrObject)  //Query Pathname of class file
    354               ->wpModuleForClass("CWAudioShadow");           
     354              ->wpModuleForClass("CWAudioShadow");
    355355            if(DosQueryModuleHandle(pathname,&hmod)) {
    356356              pathname=((WPClassManager*)SOMClassMgrObject)  //Query Pathname of class file
    357                 ->wpModuleForClass("M_CWCDFolder");           
     357                ->wpModuleForClass("M_CWCDFolder");
    358358              if(DosQueryModuleHandle(pathname,&hmod)) {
    359359                pathname=((WPClassManager*)SOMClassMgrObject)  //Query Pathname of class file
    360                   ->wpModuleForClass("CWCDFolder");           
     360                  ->wpModuleForClass("CWCDFolder");
    361361                if(DosQueryModuleHandle(pathname,&hmod)) {
    362362                  hmod=0;
     
    378378        if((found=strrchr(chrInstallDir,'\\'))!=NULLHANDLE)
    379379          *found=0;
    380        
     380
    381381        /* Save the dir for config files. */
    382382        //strcpy( chrConfigDir, chrInstallDir);
     
    393393
    394394  if(!hmod) {
    395     char path[CCHMAXPATH]; 
     395    char path[CCHMAXPATH];
    396396    char buf[CCHMAXPATH];
    397397    char* found;
    398398    APIRET rc;
    399    
    400     /* Get the language code of our system and load the 
     399
     400    /* Get the language code of our system and load the
    401401       resource DLL with the right language */
    402402    do {
     
    404404      PCSZ pszLang=chrLang;
    405405      char *chrPtr;
    406      
     406
    407407      /* Get Language var */
    408408      if(NO_ERROR!=DosScanEnv("LANG", &pszLang))
     
    419419      while(*chrPtr==' ')
    420420        chrPtr++;
    421      
     421
    422422      /* Check if value seems to be valid. The var must be something like xx_XX thus length is 5 */
    423423      if(strlen(chrPtr)<5)
    424424        break;
    425      
     425
    426426      if(DosQueryModuleName(queryModuleHandle("M_CWMediaFolder"),sizeof(path),path)!=NO_ERROR)
    427427        break;
    428      
     428
    429429      found=strrchr(path,'\\');
    430430      if(!found)
    431431        break;
    432432      *found=0;
    433      
    434       /* Extract the first two chars */               
     433
     434      /* Extract the first two chars */
    435435      sprintf(buf, RESDLLNAME, chrPtr[0], chrPtr[1]);
    436436      strcat(path,buf);
     
    438438      if(DosLoadModule(buf,sizeof(buf),path, &hmod)==NO_ERROR)
    439439        break;
    440      
     440
    441441      /* NLS DLL not found. Try to load default */
    442442      found=strrchr(path,'\\');
    443443      if(!found)
    444444        break;
    445      
     445
    446446      *found=0;
    447447      sprintf(buf, DEFRESDLLNAME);
     
    530530void M_CWMediaFolder::wpclsInitData()
    531531{
     532  static char *cls = "MMCDTrack";
     533  static somId classId = &cls;
     534
    532535  COUNTRYCODE country= {0};
    533536  COUNTRYINFO countryInfo= {0};
    534537  ULONG ulInfoLen=0;
    535538  APIRET rc;
    536   char path[CCHMAXPATH]; 
     539  char path[CCHMAXPATH];
    537540  char* found;
    538541  char buf[CCHMAXPATH];
     
    543546  /* Call parent */
    544547  M_CWProgFolder::wpclsInitData();
     548
     549  /* find out what module contains the MMCDTrackClass */
     550  /* and load MMCDTrackClass dynamically */
     551  /* need to do it this way because MMCDTrack class is */
     552  /* contained in CWMM.DLL which is not on LIBPATH */
     553  MMCDTrackClass = SOMClassMgrObject->somFindClass(classId,0,0);
    545554
    546555  /* Get slider cursor */
     
    574583  /* We don't want an automatic template because we create it during
    575584     installation because we need one with an ID so we can create a shadow
    576      without problems. So we return CLSSTYLE_DONTTEMPLATE. 
     585     without problems. So we return CLSSTYLE_DONTTEMPLATE.
    577586     Another way would be an override of wpclsCreateDefaultTemplate()
    578587     but this works, too, and we have to override this method anyway. We must
     
    591600  if(PrfQueryProfileInt(HINI_USERPROFILE, APPKEY_CWMM, MFLDR_NO_TEMPLATE_SHADOW, 0))
    592601    return;
    593  
     602
    594603  if(!WinQueryObject(ID_MEDIALDRTMPL_SHADOW))
    595604    {
     
    778787
    779788    return rc;
    780 #endif   
    781 
    782 }
    783 
    784 
    785 
    786 
    787 
    788 
    789 
    790 
    791 
    792 
     789#endif
     790
     791}
     792
     793
     794
     795
     796
     797
     798
     799
     800
     801
Note: See TracChangeset for help on using the changeset viewer.