#1 Burning Software

It is currently Wed Dec 18, 2024 11:04 pm

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: StarBurn_UDF_FormatTreeItemAsFile crash
PostPosted: Thu May 12, 2005 8:50 pm 
Offline

Joined: Thu May 12, 2005 4:30 pm
Posts: 20
I'm having a problem diagnosing a crash i am getting when calling StarBurn_UDF_FormatTreeItemAsFile. I've written my own test application based on the DVDVideoTrackAtOnceFromTree.exe sample. The main difference i have is that i create the array of UDF_TREE_ITEMs for the file items on the heap.. so i can allocate the exact number i need. If i just allocate a constant array of UDF_TREE_ITEMs my program works fine but if dynamically allocate it, it crashes. I dont see any problem with my memory management so, im confused. Any help would be appreciated. Here is the code in question and a snip of my debug log file:

pstTreeDirectories and pstTreeFiles are declared as:

UDF_TREE_ITEM stTreeDirectories[4] = {0}; //0 is unused UDF_TREE_ITEM * pstTreeFiles = NULL;

here is the problem function

LONG CDVDMovieExporter::FormatDirectoryTreeItems(PUDF_TREE_ITEM pstTreeDirectories, PUDF_TREE_ITEM & pstTreeFiles)
{
CString sTreeItem;
CStringArray arrSearchItems;
DWORD dwGuid = 0;
HANDLE hFindFile = INVALID_HANDLE_VALUE;
long n;
long nItemCount = 1;
LPTSTR szItem = 0;
WIN32_FIND_DATA stFindData = {0};

TRACE("Formatting Directories\n");

TRACE("Formatting Root Directory\n");
StarBurn_UDF_FormatTreeItemAsDirectory(&pstTreeDirectories[1], ++dwGuid, "", NULL);
TRACE("Formatting VIDEO_TS\n");
StarBurn_UDF_FormatTreeItemAsDirectory(&pstTreeDirectories[2], ++dwGuid, "VIDEO_TS", &pstTreeDirectories[1]);
TRACE("Formatting AUDIO_TS\n");
StarBurn_UDF_FormatTreeItemAsDirectory(&pstTreeDirectories[3], ++dwGuid, "AUDIO_TS", &pstTreeDirectories[1]);

sTreeItem = m_sTempDirectory + "\\VIDEO_TS\\VIDEO_TS.IFO";
arrSearchItems.Add(sTreeItem);
sTreeItem = m_sTempDirectory + "\\VIDEO_TS\\VIDEO_TS.VOB";
arrSearchItems.Add(sTreeItem);
sTreeItem = m_sTempDirectory + "\\VIDEO_TS\\VIDEO_TS.BUP";
arrSearchItems.Add(sTreeItem);
sTreeItem = m_sTempDirectory + "\\VIDEO_TS\\VTS_*.IFO";
arrSearchItems.Add(sTreeItem);
sTreeItem = m_sTempDirectory + "\\VIDEO_TS\\VTS_*.VOB";
arrSearchItems.Add(sTreeItem);
sTreeItem = m_sTempDirectory + "\\VIDEO_TS\\VTS_*.BUP";
arrSearchItems.Add(sTreeItem);

for (n = 0; n < arrSearchItems.GetSize(); n++)
{
hFindFile = FindFirstFile(arrSearchItems[n], &stFindData);

if (hFindFile != INVALID_HANDLE_VALUE)
{
while (hFindFile != INVALID_HANDLE_VALUE)
{
TRACE("Formatting %s\\VIDEO_TS\\%s as %s\n", m_sTempDirectory, stFindData.cFileName, stFindData.cFileName);
nItemCount++;

if (pstTreeFiles)
{
pstTreeFiles = (PUDF_TREE_ITEM)::HeapReAlloc(::GetProcessHeap(), HEAP_ZERO_MEMORY, pstTreeFiles, sizeof(UDF_TREE_ITEM) * (nItemCount));
}
else
{
pstTreeFiles = (PUDF_TREE_ITEM)::HeapAlloc(::GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(UDF_TREE_ITEM) * (nItemCount));
}

if (pstTreeFiles)
{
szItem = (LPTSTR)Malloc(m_sTempDirectory.GetLength() + strlen("\\VIDEO_TS\\") + strlen(stFindData.cFileName) + 1, TRUE);
sprintf(szItem, "%s\\VIDEO_TS\\%s", m_sTempDirectory, stFindData.cFileName);

StarBurn_UDF_FormatTreeItemAsFile(&pstTreeFiles[nItemCount - 1], ++dwGuid, stFindData.cFileName, szItem, &pstTreeDirectories[2]);

Free(szItem);
szItem = 0;
}

if (!FindNextFile(hFindFile, &stFindData))
{
ASSERT(GetLastError() == ERROR_NO_MORE_FILES);

//close the find if we encounter any errors
FindClose(hFindFile);
hFindFile = INVALID_HANDLE_VALUE;
}
}
}
}

TRACE("Finished Formatting Files\n");

return nItemCount;
}


the ( i think) relevant log file entries

StarBurn:UDF_FileGetSizeInUCHARs(): File size in UCHARs 8192, file size in LBs 4

StarBurn:UDF_FileGetSizeInUCHARs(): File size in UCHARs 8192, file size in LBs 4

StarBurn:UDF_FileGetSizeInUCHARs(): File size in UCHARs 24576, file size in LBs 12

StarBurn:UDF_FileGetSizeInUCHARs(): File size in UCHARs 1020375040, file size in LBs 498230


Top
 Profile  
 
 Post subject: Re: StarBurn_UDF_FormatTreeItemAsFile crash
PostPosted: Thu May 12, 2005 11:47 pm 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
I'm checking your code. Is there any chance you'd send me source/binary of your test application? I think it would speed up things quite a lot. Thanks!

P.S. anton@rocketdivision.com. Just in case :)

Brock wrote:
I'm having a problem diagnosing a crash i am getting when calling StarBurn_UDF_FormatTreeItemAsFile. I've written my own test application based on the DVDVideoTrackAtOnceFromTree.exe sample. The main difference i have is that i create the array of UDF_TREE_ITEMs for the file items on the heap.. so i can allocate the exact number i need. If i just allocate a constant array of UDF_TREE_ITEMs my program works fine but if dynamically allocate it, it crashes. I dont see any problem with my memory management so, im confused. Any help would be appreciated. Here is the code in question and a snip of my debug log file:

pstTreeDirectories and pstTreeFiles are declared as:

UDF_TREE_ITEM stTreeDirectories[4] = {0}; //0 is unused UDF_TREE_ITEM * pstTreeFiles = NULL;

here is the problem function

LONG CDVDMovieExporter::FormatDirectoryTreeItems(PUDF_TREE_ITEM pstTreeDirectories, PUDF_TREE_ITEM & pstTreeFiles)
{
CString sTreeItem;
CStringArray arrSearchItems;
DWORD dwGuid = 0;
HANDLE hFindFile = INVALID_HANDLE_VALUE;
long n;
long nItemCount = 1;
LPTSTR szItem = 0;
WIN32_FIND_DATA stFindData = {0};

TRACE("Formatting Directories\n");

TRACE("Formatting Root Directory\n");
StarBurn_UDF_FormatTreeItemAsDirectory(&pstTreeDirectories[1], ++dwGuid, "", NULL);
TRACE("Formatting VIDEO_TS\n");
StarBurn_UDF_FormatTreeItemAsDirectory(&pstTreeDirectories[2], ++dwGuid, "VIDEO_TS", &pstTreeDirectories[1]);
TRACE("Formatting AUDIO_TS\n");
StarBurn_UDF_FormatTreeItemAsDirectory(&pstTreeDirectories[3], ++dwGuid, "AUDIO_TS", &pstTreeDirectories[1]);

sTreeItem = m_sTempDirectory + "\\VIDEO_TS\\VIDEO_TS.IFO";
arrSearchItems.Add(sTreeItem);
sTreeItem = m_sTempDirectory + "\\VIDEO_TS\\VIDEO_TS.VOB";
arrSearchItems.Add(sTreeItem);
sTreeItem = m_sTempDirectory + "\\VIDEO_TS\\VIDEO_TS.BUP";
arrSearchItems.Add(sTreeItem);
sTreeItem = m_sTempDirectory + "\\VIDEO_TS\\VTS_*.IFO";
arrSearchItems.Add(sTreeItem);
sTreeItem = m_sTempDirectory + "\\VIDEO_TS\\VTS_*.VOB";
arrSearchItems.Add(sTreeItem);
sTreeItem = m_sTempDirectory + "\\VIDEO_TS\\VTS_*.BUP";
arrSearchItems.Add(sTreeItem);

for (n = 0; n < arrSearchItems.GetSize(); n++)
{
hFindFile = FindFirstFile(arrSearchItems[n], &stFindData);

if (hFindFile != INVALID_HANDLE_VALUE)
{
while (hFindFile != INVALID_HANDLE_VALUE)
{
TRACE("Formatting %s\\VIDEO_TS\\%s as %s\n", m_sTempDirectory, stFindData.cFileName, stFindData.cFileName);
nItemCount++;

if (pstTreeFiles)
{
pstTreeFiles = (PUDF_TREE_ITEM)::HeapReAlloc(::GetProcessHeap(), HEAP_ZERO_MEMORY, pstTreeFiles, sizeof(UDF_TREE_ITEM) * (nItemCount));
}
else
{
pstTreeFiles = (PUDF_TREE_ITEM)::HeapAlloc(::GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(UDF_TREE_ITEM) * (nItemCount));
}

if (pstTreeFiles)
{
szItem = (LPTSTR)Malloc(m_sTempDirectory.GetLength() + strlen("\\VIDEO_TS") + strlen(stFindData.cFileName) + 1, TRUE);
sprintf(szItem, "%s\\VIDEO_TS\\%s", m_sTempDirectory, stFindData.cFileName);

StarBurn_UDF_FormatTreeItemAsFile(&pstTreeFiles[nItemCount - 1], ++dwGuid, stFindData.cFileName, szItem, &pstTreeDirectories[2]);

Free(szItem);
szItem = 0;
}

if (!FindNextFile(hFindFile, &stFindData))
{
ASSERT(GetLastError() == ERROR_NO_MORE_FILES);

//close the find if we encounter any errors
FindClose(hFindFile);
hFindFile = INVALID_HANDLE_VALUE;
}
}
}
}

TRACE("Finished Formatting Files\n");

return nItemCount;
}


the ( i think) relevant log file entries

StarBurn:UDF_FileGetSizeInUCHARs(): File size in UCHARs 8192, file size in LBs 4

StarBurn:UDF_FileGetSizeInUCHARs(): File size in UCHARs 8192, file size in LBs 4

StarBurn:UDF_FileGetSizeInUCHARs(): File size in UCHARs 24576, file size in LBs 12

StarBurn:UDF_FileGetSizeInUCHARs(): File size in UCHARs 1020375040, file size in LBs 498230


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 13, 2005 6:35 am 
Offline

Joined: Thu May 12, 2005 4:30 pm
Posts: 20
thanks again anton...ill email you the source, binary in morning here when i go into my office. thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 13, 2005 11:51 am 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
Got nothing :( Can you put this stuff anywhere on ftp? If you don't have access to any I'll create ftp account for you at RDS site. Please let me know how we could continue. Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 13, 2005 3:18 pm 
Offline

Joined: Thu May 12, 2005 4:30 pm
Posts: 20
I just sent you an email with the source. Thanks very much for you help! :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 13, 2005 10:21 pm 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
Finally got your stuff. Would take a detailed look at it during this weekend. Thanks!

Brock wrote:
I just sent you an email with the source. Thanks very much for you help! :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 16, 2005 2:55 pm 
Offline

Joined: Thu May 12, 2005 4:30 pm
Posts: 20
Thats great. Thanks very much.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 17, 2005 11:25 am 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
Working. Would report status ASAP.

Brock wrote:
Thats great. Thanks very much.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 34 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group