Previous 15994 Revisions Next

r2469 Friday 25th April, 2008 at 13:05:04 UTC by Nathan Woods
[Windows GUI] Coding standards cleanups
[src/mess/osd/winui]softwarepicker.c

src/mess/osd/winui/softwarepicker.c
r2468r2469
4141   const device_config *device;
4242
4343   // hash information
44   char szHash[HASH_BUF_SIZE];
45   BOOL bHashRealized;
46   const hash_info *pHashInfo;
44   char hash_string[HASH_BUF_SIZE];
45   BOOL hash_realized;
46   const hash_info *hashinfo;
4747
48   LPCSTR pszZipEntryName;
49   LPCSTR pszSubName;
50   char szFilename[1];
48   const char *zip_entry_name;
49   const char *base_name;
50   char file_name[1];
5151};
5252
5353typedef struct _directory_search_info directory_search_info;
5454struct _directory_search_info
5555{
56   directory_search_info *pNext;
57   HANDLE hFind;
56   directory_search_info *next;
57   HANDLE find_handle;
5858   WIN32_FIND_DATA fd;
59   char szDirectory[1];
59   char directory_name[1];
6060};
6161
6262typedef struct _software_picker_info software_picker_info;
6363struct _software_picker_info
6464{
65   WNDPROC pfnOldWndProc;
66   file_info **ppIndex;
67   int nIndexLength;
68   int nHashesRealized;
69   int nCurrentPosition;
70   directory_search_info *pFirstSearchInfo;
71   directory_search_info *pLastSearchInfo;
72   const game_driver *pDriver;
73   machine_config *pConfig;
74   hash_file *pHashFile;
75   void (*pfnErrorProc)(const char *message);
65   WNDPROC old_window_proc;
66   file_info **file_index;
67   int file_index_length;
68   int hashes_realized;
69   int current_position;
70   directory_search_info *first_search_info;
71   directory_search_info *last_search_info;
72   const game_driver *driver;
73   machine_config *config;
74   hash_file *hashfile;
75   void (*error_callback)(const char *message);
7676};
7777
7878
r2468r2469
8181//  CONSTANTS
8282//============================================================
8383
84static const TCHAR s_szSoftwarePickerProp[] = TEXT("SWPICKER");
84static const TCHAR software_picker_property_name[] = TEXT("SWPICKER");
8585
8686
8787
r2468r2469
131131static software_picker_info *GetSoftwarePickerInfo(HWND hwndPicker)
132132{
133133   HANDLE h;
134   h = GetProp(hwndPicker, s_szSoftwarePickerProp);
134   h = GetProp(hwndPicker, software_picker_property_name);
135135   assert(h);
136136   return (software_picker_info *) h;
137137}
r2468r2469
142142{
143143   software_picker_info *pPickerInfo;
144144   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
145   if ((nIndex < 0) || (nIndex >= pPickerInfo->nIndexLength))
145   if ((nIndex < 0) || (nIndex >= pPickerInfo->file_index_length))
146146      return NULL;
147   return pPickerInfo->ppIndex[nIndex]->szFilename;
147   return pPickerInfo->file_index[nIndex]->file_name;
148148}
149149
150150
r2468r2469
153153{
154154   software_picker_info *pPickerInfo;
155155   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
156   if ((nIndex < 0) || (nIndex >= pPickerInfo->nIndexLength))
156   if ((nIndex < 0) || (nIndex >= pPickerInfo->file_index_length))
157157   {
158158      return NULL;
159159   }
160   return pPickerInfo->ppIndex[nIndex]->device;
160   return pPickerInfo->file_index[nIndex]->device;
161161}
162162
163163
r2468r2469
168168   int i;
169169
170170   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
171   for (i = 0; i < pPickerInfo->nIndexLength; i++)
171   for (i = 0; i < pPickerInfo->file_index_length; i++)
172172   {
173      if (!mame_stricmp(pPickerInfo->ppIndex[i]->szFilename, pszFilename))
173      if (!mame_stricmp(pPickerInfo->file_index[i]->file_name, pszFilename))
174174         return i;
175175   }
176176   return -1;
r2468r2469
185185
186186   if (device != NULL)
187187   {
188      type = image_device_getinfo(GetSoftwarePickerInfo(hwndPicker)->pConfig, device).type;
188      type = image_device_getinfo(GetSoftwarePickerInfo(hwndPicker)->config, device).type;
189189   }
190190   else
191191   {
r2468r2469
196196
197197
198198
199void SoftwarePicker_SetDriver(HWND hwndPicker, const game_driver *pDriver)
199void SoftwarePicker_SetDriver(HWND hwndPicker, const game_driver *driver)
200200{
201201   software_picker_info *pPickerInfo;
202202   int i;
r2468r2469
204204   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
205205
206206   // did the driver change?
207   if (pPickerInfo->pDriver != pDriver)
207   if (pPickerInfo->driver != driver)
208208   {
209209      // is there a hash file loaded?
210      if (pPickerInfo->pHashFile != NULL)
210      if (pPickerInfo->hashfile != NULL)
211211      {
212212         // close down the file
213         hashfile_close(pPickerInfo->pHashFile);
214         pPickerInfo->pHashFile = NULL;
213         hashfile_close(pPickerInfo->hashfile);
214         pPickerInfo->hashfile = NULL;
215215
216216         // invalidate the hash "realization"
217         for (i = 0; i < pPickerInfo->nIndexLength; i++)
217         for (i = 0; i < pPickerInfo->file_index_length; i++)
218218         {
219            pPickerInfo->ppIndex[i]->pHashInfo = NULL;
220            pPickerInfo->ppIndex[i]->bHashRealized = FALSE;
219            pPickerInfo->file_index[i]->hashinfo = NULL;
220            pPickerInfo->file_index[i]->hash_realized = FALSE;
221221         }
222         pPickerInfo->nHashesRealized = 0;
222         pPickerInfo->hashes_realized = 0;
223223      }
224224
225225      // is there a machine_config loaded?
226      if (pPickerInfo->pConfig != NULL)
226      if (pPickerInfo->config != NULL)
227227      {
228228         // free the machine_config
229         machine_config_free(pPickerInfo->pConfig);
230         pPickerInfo->pConfig = NULL;
229         machine_config_free(pPickerInfo->config);
230         pPickerInfo->config = NULL;
231231      }
232232
233233      // change the driver value
234      pPickerInfo->pDriver = pDriver;
234      pPickerInfo->driver = driver;
235235
236236      // if we have a driver, we have to load some stuff
237      if (pDriver != NULL)
237      if (driver != NULL)
238238      {
239239         // get the configuration
240         pPickerInfo->pConfig = machine_config_alloc_with_mess_devices(pDriver);
240         pPickerInfo->config = machine_config_alloc_with_mess_devices(driver);
241241
242242         // find a hash file
243         while((pDriver != NULL) && !pPickerInfo->pHashFile)
243         while((driver != NULL) && !pPickerInfo->hashfile)
244244         {
245            pPickerInfo->pHashFile = hashfile_open_options(MameUIGlobal(), pDriver->name, TRUE, pPickerInfo->pfnErrorProc);
246            pDriver = mess_next_compatible_driver(pDriver);
245            pPickerInfo->hashfile = hashfile_open_options(MameUIGlobal(), driver->name, TRUE, pPickerInfo->error_callback);
246            driver = mess_next_compatible_driver(driver);
247247         }
248248      }
249249   }
r2468r2469
251251
252252
253253
254void SoftwarePicker_SetErrorProc(HWND hwndPicker, void (*pfnErrorProc)(const char *message))
254void SoftwarePicker_SetErrorProc(HWND hwndPicker, void (*error_callback)(const char *message))
255255{
256256   software_picker_info *pPickerInfo;
257257   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
258   pPickerInfo->pfnErrorProc = pfnErrorProc;
258   pPickerInfo->error_callback = error_callback;
259259}
260260
261261
r2468r2469
267267   unsigned int functions;
268268
269269   // get the device info
270   info = image_device_getinfo(pPickerInfo->pConfig, pFileInfo->device);
270   info = image_device_getinfo(pPickerInfo->config, pFileInfo->device);
271271
272272   // determine which functions to use
273   functions = hashfile_functions_used(pPickerInfo->pHashFile, info.type);
273   functions = hashfile_functions_used(pPickerInfo->hashfile, info.type);
274274
275275   // compute the hash
276   image_device_compute_hash(pFileInfo->szHash, pFileInfo->device, pBuffer, nLength, functions);
276   image_device_compute_hash(pFileInfo->hash_string, pFileInfo->device, pBuffer, nLength, functions);
277277}
278278
279279
r2468r2469
290290   LVFINDINFO lvfi;
291291
292292   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
293   assert((nIndex >= 0) && (nIndex < pPickerInfo->nIndexLength));
294   pFileInfo = pPickerInfo->ppIndex[nIndex];
293   assert((nIndex >= 0) && (nIndex < pPickerInfo->file_index_length));
294   pFileInfo = pPickerInfo->file_index[nIndex];
295295
296   if (pFileInfo->pszZipEntryName)
296   if (pFileInfo->zip_entry_name)
297297   {
298298      // this is in a ZIP file
299299      zip_file *zip;
r2468r2469
301301      const zip_file_header *zipent;
302302
303303      // open the ZIP file
304      nLength = pFileInfo->pszZipEntryName - pFileInfo->szFilename;
304      nLength = pFileInfo->zip_entry_name - pFileInfo->file_name;
305305      pszZipName = (LPSTR) alloca(nLength);
306      memcpy(pszZipName, pFileInfo->szFilename, nLength);
306      memcpy(pszZipName, pFileInfo->file_name, nLength);
307307      pszZipName[nLength - 1] = '\0';
308308
309309      // get the entry name
r2468r2469
313313         zipent = zip_file_first_file(zip);
314314         while(!rc && zipent)
315315         {
316            if (!mame_stricmp(zipent->filename, pFileInfo->pszZipEntryName))
316            if (!mame_stricmp(zipent->filename, pFileInfo->zip_entry_name))
317317            {
318318               pBuffer = malloc(zipent->uncompressed_length);
319319               if (pBuffer)
r2468r2469
335335   else
336336   {
337337      // plain open file; map it into memory and calculate the hash
338      hFile = win_create_file_utf8(pFileInfo->szFilename, GENERIC_READ, FILE_SHARE_READ, NULL,
338      hFile = win_create_file_utf8(pFileInfo->file_name, GENERIC_READ, FILE_SHARE_READ, NULL,
339339         OPEN_EXISTING, 0, NULL);
340340      if (hFile != INVALID_HANDLE_VALUE)
341341      {
r2468r2469
380380   iodevice_t type;
381381
382382   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
383   assert((nIndex >= 0) && (nIndex < pPickerInfo->nIndexLength));
384   pFileInfo = pPickerInfo->ppIndex[nIndex];
383   assert((nIndex >= 0) && (nIndex < pPickerInfo->file_index_length));
384   pFileInfo = pPickerInfo->file_index[nIndex];
385385
386386   // Determine which hash functions we need to use for this file, and which hashes
387387   // have already been calculated
388   if ((pPickerInfo->pHashFile != NULL) && (pFileInfo->device != NULL))
388   if ((pPickerInfo->hashfile != NULL) && (pFileInfo->device != NULL))
389389   {
390      image_device_info info = image_device_getinfo(pPickerInfo->pConfig, pFileInfo->device);
390      image_device_info info = image_device_getinfo(pPickerInfo->config, pFileInfo->device);
391391      type = info.type;
392392      if (type < IO_COUNT)
393           nHashFunctionsUsed = hashfile_functions_used(pPickerInfo->pHashFile, type);
394      nCalculatedHashes = hash_data_used_functions(pFileInfo->szHash);
393           nHashFunctionsUsed = hashfile_functions_used(pPickerInfo->hashfile, type);
394      nCalculatedHashes = hash_data_used_functions(pFileInfo->hash_string);
395395   }
396396
397397   // Did we fully compute all hashes?
398398   if ((nHashFunctionsUsed & ~nCalculatedHashes) == 0)
399399   {
400400      // We have calculated all hashs for this file; mark it as realized
401      pPickerInfo->ppIndex[nIndex]->bHashRealized = TRUE;
402      pPickerInfo->nHashesRealized++;
401      pPickerInfo->file_index[nIndex]->hash_realized = TRUE;
402      pPickerInfo->hashes_realized++;
403403
404      if (pPickerInfo->pHashFile)
404      if (pPickerInfo->hashfile)
405405      {
406         pPickerInfo->ppIndex[nIndex]->pHashInfo = hashfile_lookup(pPickerInfo->pHashFile,
407            pPickerInfo->ppIndex[nIndex]->szHash);
406         pPickerInfo->file_index[nIndex]->hashinfo = hashfile_lookup(pPickerInfo->hashfile,
407            pPickerInfo->file_index[nIndex]->hash_string);
408408      }
409409   }
410410}
r2468r2469
430430   // look up the device
431431   if (strrchr(pszFilename, '.'))
432432      pszExtension = strrchr(pszFilename, '.');
433   if ((pszExtension != NULL) && (pPickerInfo->pDriver != NULL))
433   if ((pszExtension != NULL) && (pPickerInfo->driver != NULL))
434434   {
435      for (device = image_device_first(pPickerInfo->pConfig); device != NULL; device = image_device_next(device))
435      for (device = image_device_first(pPickerInfo->config); device != NULL; device = image_device_next(device))
436436      {
437437         if (image_device_uses_file_extension(device, pszExtension))
438438            break;
r2468r2469
451451   memset(pInfo, 0, nSize);
452452
453453   // copy the filename
454   strcpy(pInfo->szFilename, pszFilename);
454   strcpy(pInfo->file_name, pszFilename);
455455
456456   // set up device and CRC, if specified
457457   pInfo->device = device;
458   if ((device != NULL) && (image_device_getinfo(pPickerInfo->pConfig, device).has_partial_hash != 0))
458   if ((device != NULL) && (image_device_getinfo(pPickerInfo->config, device).has_partial_hash != 0))
459459      nCrc = 0;
460460   if (nCrc != 0)
461      snprintf(pInfo->szHash, sizeof(pInfo->szHash) / sizeof(pInfo->szHash[0]), "c:%08x#", nCrc);
461      snprintf(pInfo->hash_string, sizeof(pInfo->hash_string) / sizeof(pInfo->hash_string[0]), "c:%08x#", nCrc);
462462
463463   // set up zip entry name length, if specified
464464   if (nZipEntryNameLength > 0)
465      pInfo->pszZipEntryName = pInfo->szFilename + strlen(pInfo->szFilename) - nZipEntryNameLength;
465      pInfo->zip_entry_name = pInfo->file_name + strlen(pInfo->file_name) - nZipEntryNameLength;
466466
467467   // calculate the subname
468   pInfo->pszSubName = strrchr(pInfo->szFilename, '\\');
469   if (pInfo->pszSubName)
470      pInfo->pszSubName++;
468   pInfo->base_name = strrchr(pInfo->file_name, '\\');
469   if (pInfo->base_name)
470      pInfo->base_name++;
471471   else
472      pInfo->pszSubName = pInfo->szFilename;
472      pInfo->base_name = pInfo->file_name;
473473
474   ppNewIndex = realloc(pPickerInfo->ppIndex, (pPickerInfo->nIndexLength + 1) * sizeof(*pPickerInfo->ppIndex));
474   ppNewIndex = realloc(pPickerInfo->file_index, (pPickerInfo->file_index_length + 1) * sizeof(*pPickerInfo->file_index));
475475   if (!ppNewIndex)
476476      goto error;
477477
478   nIndex = pPickerInfo->nIndexLength++;
479   pPickerInfo->ppIndex = ppNewIndex;
480   pPickerInfo->ppIndex[nIndex] = pInfo;
478   nIndex = pPickerInfo->file_index_length++;
479   pPickerInfo->file_index = ppNewIndex;
480   pPickerInfo->file_index[nIndex] = pInfo;
481481
482482   // Realize the hash
483483   SoftwarePicker_RealizeHash(hwndPicker, nIndex);
r2468r2469
584584   if (!pSearchInfo)
585585      return FALSE;
586586   memset(pSearchInfo, 0, nSearchInfoSize);
587   pSearchInfo->hFind = INVALID_HANDLE_VALUE;
587   pSearchInfo->find_handle = INVALID_HANDLE_VALUE;
588588
589   strcpy(pSearchInfo->szDirectory, pszDirectory);
589   strcpy(pSearchInfo->directory_name, pszDirectory);
590590
591591   // insert into linked list
592   if (pPickerInfo->pLastSearchInfo)
593      ppLast = &pPickerInfo->pLastSearchInfo->pNext;
592   if (pPickerInfo->last_search_info)
593      ppLast = &pPickerInfo->last_search_info->next;
594594   else
595      ppLast = &pPickerInfo->pFirstSearchInfo;
595      ppLast = &pPickerInfo->first_search_info;
596596   *ppLast = pSearchInfo;
597   pPickerInfo->pLastSearchInfo = pSearchInfo;
597   pPickerInfo->last_search_info = pSearchInfo;
598598   return TRUE;
599599}
600600
r2468r2469
602602
603603static void SoftwarePicker_FreeSearchInfo(directory_search_info *pSearchInfo)
604604{
605   if (pSearchInfo->hFind != INVALID_HANDLE_VALUE)
606      FindClose(pSearchInfo->hFind);
605   if (pSearchInfo->find_handle != INVALID_HANDLE_VALUE)
606      FindClose(pSearchInfo->find_handle);
607607   free(pSearchInfo);
608608}
609609
r2468r2469
614614   directory_search_info *p;
615615   int i;
616616
617   for (i = 0; i < pPickerInfo->nIndexLength; i++)
618      free(pPickerInfo->ppIndex[i]);
617   for (i = 0; i < pPickerInfo->file_index_length; i++)
618      free(pPickerInfo->file_index[i]);
619619
620   while(pPickerInfo->pFirstSearchInfo)
620   while(pPickerInfo->first_search_info)
621621   {
622      p = pPickerInfo->pFirstSearchInfo->pNext;
623      SoftwarePicker_FreeSearchInfo(pPickerInfo->pFirstSearchInfo);
624      pPickerInfo->pFirstSearchInfo = p;
622      p = pPickerInfo->first_search_info->next;
623      SoftwarePicker_FreeSearchInfo(pPickerInfo->first_search_info);
624      pPickerInfo->first_search_info = p;
625625   }
626626
627   pPickerInfo->ppIndex = NULL;
628   pPickerInfo->nIndexLength = 0;
629   pPickerInfo->nCurrentPosition = 0;
630   pPickerInfo->pLastSearchInfo = NULL;
627   pPickerInfo->file_index = NULL;
628   pPickerInfo->file_index_length = 0;
629   pPickerInfo->current_position = 0;
630   pPickerInfo->last_search_info = NULL;
631631}
632632
633633
r2468r2469
661661      return TRUE;
662662   }
663663
664   pszFilename = alloca(strlen(pSearchInfo->szDirectory) + 1 + strlen(utf8_FileName) + 1);
665   strcpy(pszFilename, pSearchInfo->szDirectory);
664   pszFilename = alloca(strlen(pSearchInfo->directory_name) + 1 + strlen(utf8_FileName) + 1);
665   strcpy(pszFilename, pSearchInfo->directory_name);
666666   strcat(pszFilename, "\\");
667667   strcat(pszFilename, utf8_FileName);
668668
r2468r2469
691691
692692   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
693693
694   pSearchInfo = pPickerInfo->pFirstSearchInfo;
694   pSearchInfo = pPickerInfo->first_search_info;
695695   if (pSearchInfo)
696696   {
697697      // searching through directories
698      if (pSearchInfo->hFind != INVALID_HANDLE_VALUE)
698      if (pSearchInfo->find_handle != INVALID_HANDLE_VALUE)
699699      {
700         bSuccess = FindNextFile(pSearchInfo->hFind, &pSearchInfo->fd);
700         bSuccess = FindNextFile(pSearchInfo->find_handle, &pSearchInfo->fd);
701701      }
702702      else
703703      {
704         pszFilter = alloca(strlen(pSearchInfo->szDirectory) + strlen(szWildcards) + 1);
705         strcpy(pszFilter, pSearchInfo->szDirectory);
704         pszFilter = alloca(strlen(pSearchInfo->directory_name) + strlen(szWildcards) + 1);
705         strcpy(pszFilter, pSearchInfo->directory_name);
706706         strcat(pszFilter, szWildcards);
707         pSearchInfo->hFind = win_find_first_file_utf8(pszFilter, &pSearchInfo->fd);
708         bSuccess = pSearchInfo->hFind != INVALID_HANDLE_VALUE;
707         pSearchInfo->find_handle = win_find_first_file_utf8(pszFilter, &pSearchInfo->fd);
708         bSuccess = pSearchInfo->find_handle != INVALID_HANDLE_VALUE;
709709      }
710710
711711      if (bSuccess)
r2468r2469
714714      }
715715      else
716716      {
717         pPickerInfo->pFirstSearchInfo = pSearchInfo->pNext;
718         if (!pPickerInfo->pFirstSearchInfo)
719            pPickerInfo->pLastSearchInfo = NULL;
717         pPickerInfo->first_search_info = pSearchInfo->next;
718         if (!pPickerInfo->first_search_info)
719            pPickerInfo->last_search_info = NULL;
720720         SoftwarePicker_FreeSearchInfo(pSearchInfo);
721721      }
722722   }
723   else if (pPickerInfo->pHashFile && (pPickerInfo->nHashesRealized
724      < pPickerInfo->nIndexLength))
723   else if (pPickerInfo->hashfile && (pPickerInfo->hashes_realized
724      < pPickerInfo->file_index_length))
725725   {
726726      // time to realize some hashes
727727      nCount = 100;
728728
729      while((nCount > 0) && pPickerInfo->ppIndex[pPickerInfo->nCurrentPosition]->bHashRealized)
729      while((nCount > 0) && pPickerInfo->file_index[pPickerInfo->current_position]->hash_realized)
730730      {
731         pPickerInfo->nCurrentPosition++;
732         pPickerInfo->nCurrentPosition %= pPickerInfo->nIndexLength;
731         pPickerInfo->current_position++;
732         pPickerInfo->current_position %= pPickerInfo->file_index_length;
733733         nCount--;
734734      }
735735
736      pFileInfo = pPickerInfo->ppIndex[pPickerInfo->nCurrentPosition];
737      if (!pFileInfo->bHashRealized)
736      pFileInfo = pPickerInfo->file_index[pPickerInfo->current_position];
737      if (!pFileInfo->hash_realized)
738738      {
739739         type = mess_device_from_core_device(pFileInfo->device)->type;
740         if (hashfile_functions_used(pPickerInfo->pHashFile, type))
740         if (hashfile_functions_used(pPickerInfo->hashfile, type))
741741         {
742742            // only calculate the hash if it is appropriate for this device
743            if (!SoftwarePicker_CalculateHash(hwndPicker, pPickerInfo->nCurrentPosition))
743            if (!SoftwarePicker_CalculateHash(hwndPicker, pPickerInfo->current_position))
744744               return FALSE;
745745         }
746         SoftwarePicker_RealizeHash(hwndPicker, pPickerInfo->nCurrentPosition);
746         SoftwarePicker_RealizeHash(hwndPicker, pPickerInfo->current_position);
747747
748748         // under normal circumstances this will be redundant, but in the unlikely
749749         // event of a failure, we do not want to keep running into a brick wall
750750         // by calculating this hash over and over
751         if (!pPickerInfo->ppIndex[pPickerInfo->nCurrentPosition]->bHashRealized)
751         if (!pPickerInfo->file_index[pPickerInfo->current_position]->hash_realized)
752752         {
753            pPickerInfo->ppIndex[pPickerInfo->nCurrentPosition]->bHashRealized = TRUE;
754            pPickerInfo->nHashesRealized++;
753            pPickerInfo->file_index[pPickerInfo->current_position]->hash_realized = TRUE;
754            pPickerInfo->hashes_realized++;
755755         }
756756      }
757757   }
r2468r2469
778778   TCHAR* t_buf;
779779
780780   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
781   if ((nRow < 0) || (nRow >= pPickerInfo->nIndexLength))
781   if ((nRow < 0) || (nRow >= pPickerInfo->file_index_length))
782782      return NULL;
783783
784   pFileInfo = pPickerInfo->ppIndex[nRow];
784   pFileInfo = pPickerInfo->file_index[nRow];
785785
786786   switch(nColumn)
787787   {
788788      case MESS_COLUMN_IMAGES:
789         t_buf = tstring_from_utf8(pFileInfo->pszSubName);
789         t_buf = tstring_from_utf8(pFileInfo->base_name);
790790         if( !t_buf )
791791            return s;
792792         _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf);
r2468r2469
798798      case MESS_COLUMN_MANUFACTURER:
799799      case MESS_COLUMN_YEAR:
800800      case MESS_COLUMN_PLAYABLE:
801         if (pFileInfo->pHashInfo)
801         if (pFileInfo->hashinfo)
802802         {
803803            switch(nColumn)
804804            {
805805               case MESS_COLUMN_GOODNAME:
806                  pszUtf8 = pFileInfo->pHashInfo->longname;
806                  pszUtf8 = pFileInfo->hashinfo->longname;
807807                  break;
808808               case MESS_COLUMN_MANUFACTURER:
809                  pszUtf8 = pFileInfo->pHashInfo->manufacturer;
809                  pszUtf8 = pFileInfo->hashinfo->manufacturer;
810810                  break;
811811               case MESS_COLUMN_YEAR:
812                  pszUtf8 = pFileInfo->pHashInfo->year;
812                  pszUtf8 = pFileInfo->hashinfo->year;
813813                  break;
814814               case MESS_COLUMN_PLAYABLE:
815                  pszUtf8 = pFileInfo->pHashInfo->playable;
815                  pszUtf8 = pFileInfo->hashinfo->playable;
816816                  break;
817817            }
818818            if (pszUtf8)
r2468r2469
836836            case MESS_COLUMN_MD5:   nHashFunction = HASH_MD5;   break;
837837            case MESS_COLUMN_SHA1:   nHashFunction = HASH_SHA1;   break;
838838         }
839         if (hash_data_extract_printable_checksum(pFileInfo->szHash, nHashFunction, szBuffer))
839         if (hash_data_extract_printable_checksum(pFileInfo->hash_string, nHashFunction, szBuffer))
840840         {
841841            t_buf = tstring_from_utf8(szBuffer);
842842            if( !t_buf )
r2468r2469
859859   LRESULT rc;
860860
861861   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
862   rc = CallWindowProc(pPickerInfo->pfnOldWndProc, hwndPicker, nMessage, wParam, lParam);
862   rc = CallWindowProc(pPickerInfo->old_window_proc, hwndPicker, nMessage, wParam, lParam);
863863
864864   if (nMessage == WM_DESTROY)
865865   {
r2468r2469
886886      goto error;
887887   memset(pPickerInfo, 0, sizeof(*pPickerInfo));
888888
889   if (!SetProp(hwndPicker, s_szSoftwarePickerProp, (HANDLE) pPickerInfo))
889   if (!SetProp(hwndPicker, software_picker_property_name, (HANDLE) pPickerInfo))
890890      goto error;
891891
892892   l = (LONG_PTR) SoftwarePicker_WndProc;
893893   l = SetWindowLongPtr(hwndPicker, GWLP_WNDPROC, l);
894   pPickerInfo->pfnOldWndProc = (WNDPROC) l;
894   pPickerInfo->old_window_proc = (WNDPROC) l;
895895   return TRUE;
896896
897897error:

Previous 15994 Revisions Next


© 1998-2018 The MESS Team