Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Read long Joilet-Filenames from CD (MSDOS)

Posted on 1999-07-12
26
Medium Priority
?
369 Views
Last Modified: 2010-04-15
Dear Programmers out there!

I have a really hard Question...
I would like to read the "long" Joliet-Filenames from a CD-drive under MS-DOS 6.22 (MSCDEX 2.25)
I think this should be possible somehow, but I have no idea how to manage this. I would be very glad about "some" lines of c-code that does this job. Is there somebody who has a pretty finished solution?
Thank You guys!
Martin
0
Comment
Question by:Mittelberger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 8
  • 4
  • +5
26 Comments
 

Author Comment

by:Mittelberger
ID: 1263534
Edited text of question.
0
 
LVL 2

Expert Comment

by:lucidity
ID: 1263535
I don't have the technically correct answer for this but I know that you can do this with a little parsing code.. You notice that if you do a dir command you get the short filename followed by some details one of which is the long filename. If you do a sys command like "dir > input.txt" then parse the text file to match short filenames with the long files names you have what you want. If there is a better way (which I am sure there is) I would also like to know.
0
 
LVL 86

Expert Comment

by:jkr
ID: 1263536
The problem is the DOS6.22 requirement - it knows nothing about LFN. DOS7 (which ships with Win95) has a 'int 21h' call which does the filename translation...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:kschang
ID: 1263537
MSCDEX ONLY supports the 8.3 filename... I can't think of any way you can get to the long names without writing your own UDF driver, which not even Adaptec, the makers of EasyCD, is willing to do (yet).
0
 
LVL 2

Expert Comment

by:lucidity
ID: 1263538
you could just dump the FAT to a file, or otherwise access it, and start searching through that. Just an idea, I know nothing about the FAT file setup.
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1263539
To jkr: what exectly command in 21h interruption translate short name to LFN?
I don't find it...
0
 

Author Comment

by:Mittelberger
ID: 1263540
Hi Friends!

Thank You for Your hints!
Meanwhile I've found a solution in PASCAL :(
Would like to have the same thing for BC5...
I think I have to "translate" this stuff -
I'm absolutely bad in PASCAL, hope I'll make it.
Drop me an email an I'll send You the PASCAL-Source if You need it.

Martin
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1263541
my EMail shrlin@apelker.co.il
Send and i 'll try...
0
 

Expert Comment

by:prabhuram
ID: 1263542
I'll try too: roopch@hotmail.com
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1263543
Hi, I ,of couse, "translate" to C only part of Programm, that
convert short name to Long Name.
See Programm. Some Remarks:
after Interruption 0x2F with regs.x.ax = 0x150F
we get Dir element in "canonicalized" form .
Description of this form see in Interruption list of Rulf Broun
file interrupt.k

void cdecl main (void)
{
  struct SREGS sregs;
  union  REGS regs;
  char   szInFile[255];
  char   szOutFile[255];
  char   szDir[255];
  int i,len;

  clrscr ();                              //clear screen
                              //clear all
  memset(&sregs , 0, sizeof(sregs));
  memset(&regs , 0, sizeof(regs));

  strcpy(szInFile, "\\win95\\fullver\\hebrew\\cd\\iwmsie~6.exe");
  memset(szOutFile, 0, sizeof(szOutFile));
  memset(szDir, 0, sizeof(szDir));

  sregs.es = FP_SEG(szInFile);
  regs.x.si = FP_SEG(szDir);
  regs.x.bx = FP_OFF(szInFile);
  regs.x.di = FP_OFF(szDir);
//                     absread(as Interruption, vers 4.0 and more)
  regs.x.ax = 0x150F;                  //disk C
  regs.h.cl = 4;                  //disk C
  regs.h.ch = 1;                  //disk C

  int86x(0x2F, &regs, &regs, &sregs);      //read
  i = _doserrno;                       //if error, > 0
  if (i == 0)
    {
      int j;
      for (i = 25,j = 0; i < 60; i += 2,j++)
      szOutFile[j]=szDir[i];
      puts(szOutFile); getch();
    }
}
0
 
LVL 4

Expert Comment

by:SaGS
ID: 1263544
I may try too, and I'm also interested in this.
If the Pascal source is freely available on the Net, no need to mail the sources, please just let me know the URL and I'll get it from there.

Thanks, sags5495@hotmail.com

0
 

Author Comment

by:Mittelberger
ID: 1263545
Hi Alex!

Sorry for not viewing Your answer for such a long time...
Meanwhile I've found c-sources for the pascal-functions that I mailed You (controlling MSCDEX).
It seems that Your answer only works with drive c.

The solution I need should read long filenames from a CD-Rom drive (e.g. d: or so).
I'll email You the appropriate c-sources - so You can adapt Your answer to them - I'm sorry, it's not really the thing I was looking for...
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1263546
Mittelberger, dou you test this programm, or see only to
comments?( that for me, not you!).
regs.h.cl = 4; //4: meaning: 0: current, 1: a,2, b,...
4: it is my CD!
I TEST THIS CODE for my  CD and IT IS WORK!
Best Regards, Alex

0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1263547
For read short names from CD you use standart metods:
findfirst/findnext. My ocode only convert SHORT name
to LONG.  
0
 

Author Comment

by:Mittelberger
ID: 1263548
Hi Alex!

Sorry, didn't really try - as You guessed.
Will try it as soon as possible - please hold on some days - You'll get Your points if it works - dont worry!

Thanks a lot!

Martin
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1263549
Hai, Martin. I wait, and to make things less confusing,
I rewrite my code as function(and delete all comments!) :
// Parameters:
// nDrive : index of Drive : 0:A, 1: B, ..4: E, ..
//szShort : short name
//szLong : result long name of file(without way)
// Function return: >0 : error(file not found or drive
//                                  not CD
//      0: OK
int ShortToLond(int nDrive, chare *szShort, char *szLong)
{
  struct SREGS sregs;
  union  REGS regs;
  char   szInFile[255];
  char   szDir[255];

  memset(&sregs , 0, sizeof(sregs));
  memset(&regs , 0, sizeof(regs));

  strcpy(szInFile, szShort);
  memset(szDir, 0, sizeof(szDir));

  sregs.es = FP_SEG(szInFile);
  regs.x.si = FP_SEG(szDir);
  regs.x.bx = FP_OFF(szInFile);
  regs.x.di = FP_OFF(szDir);

  regs.x.ax = 0x150F;  
  regs.h.cl = nDrive;  
  regs.h.ch = 1;  

  int86x(0x2F, &regs, &regs, &sregs);  

  if (_doserrno == 0)
    {
      int j,i;
      for (i = 25,j = 0; i < 60; i += 2,j++)
         szLong[j]=szDir[i];
      szLong[j] = 0;
    }
  return  _doserrno;
}
0
 

Author Comment

by:Mittelberger
ID: 1263550
Dear AlexVirochovsky!

I've written a short C-program containing Your function.
Unfortunately the result is not as expected.
If You tell me Your email-address I will mail this not working sources (and the .exe) to You.

Meanwhile SaGS has mailed a working solution to me - so I want him to get the "reward" for his brilliant work.

I am sorry for You, but don't worry, maybe next time.

Regards Martin

0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1263551
my EMail shrlin@apelker.co.il

0
 
LVL 4

Expert Comment

by:SaGS
ID: 1263552
I'm online again, how are things going in here?
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1263553
Dear Martin, i 've send you EMail with fixed version
of you test programm. Dou you get it?
to SaGS:  as Martin wrote:
>>Meanwhile SaGS has mailed a working solution to me - >>so I want him to get the "reward" for his brilliant work.
I think, you MUST reply!
0
 

Author Comment

by:Mittelberger
ID: 1263554
Dear Alex!

Yes I've got Your fixed version last week - unfortunately I was on hollidays over the weekend - so I had no time until now to give You a feedback. I've still got problems with Your version, I will try to catch a screen-shot of it's output and mail it to You - I haven't a clue about that problem. It does absolutely not look like long filenames, just some strange characters appear. Just hold on - You'll get the output as an email...
Do You think, that the CD-burning-software could be the reason for the problem? I use the software bundled with my HP shurestore 8100i, think it is Easy CD Creator or something like that (have got it at home, not here at work), but this software works very well in all other circumstances - and also with the Software written by SaGs.
0
 
LVL 4

Expert Comment

by:SaGS
ID: 2090984
Should I "answer" this?
0
 

Author Comment

by:Mittelberger
ID: 2095736
Hi SaGS!

Nice to hear from You again!
I think we should proceed like that:
Your Solution works perfect - I'm really happy with it.
So please answer this question "officially" like proposed and I can finally give You Your well-earned points.
Unfortunately Alex' version doesn't work on my system...
.... therefore You're my winner of this "competition".

Thanks again for Your help - get Your points!
0
 
LVL 4

Accepted Solution

by:
SaGS earned 1600 total points
ID: 2095845
See files I've sent by mail (too large to post them here).
0
 

Author Comment

by:Mittelberger
ID: 2095875
If someone is interested in the files mentioned by SaGS - Just send an email to mittelberger@xoom.com, maybe I'll put them on my website (http://members.xoom.com/mittelberger) one day... together with my MP3-Player Project.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6820324
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects that and the expert will now receive these points, all verified.
Moondancer
Moderator @ Experts Exchange
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question