473,473 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Debug Assertion Failed! msvcr80d.dll!__loctotime64_t Expression: (((long)(yr-1900) >= _BASE_YEAR) && ((long)(yr - 1900) <=

It seems that windows file systems can have files dated to 1617, and
unfortunately if you call _findfirst/_findnext on such a directory,
msvcr80d will assert.

Is there some provision for changing msvcr80d so that this assert
doesn't happen?

Debug Assertion Failed!
File: dtoxtm64.c
Line: 67

Expression: (((long)(yr-1900) >= _BASE_YEAR) && ((long)(yr - 1900) <=
_MAX_YEAR64))

The top of the stack was:
msvcr80d.dll!__loctotime64_t(int yr=1617, int mo=11, int dy=3, int
hr=1, int mn=26, int sc=9, int dstflag=-1) Line 67 + 0x57 bytes C
msvcr80d.dll!__time64_t_from_ft(_FILETIME * pft=0x0012c52c) Line 253 +
0x25 bytes C
msvcr80d.dll!_findnext64i32(int hFile=1484232, _finddata64i32_t *
pfd=0x0012c684) Line 187 + 0xc bytes C

full details and stack can be found at:
https://bugzilla.mozilla.org/show_bug.cgi?id=331404

If there's some more appropriate group for this question, please let me
know. I searched around a bit, and this group seemed to be one of very
few candidates.

Mar 23 '06 #1
4 6370
Hi Josh!
It seems that windows file systems can have files dated to 1617, and
unfortunately if you call _findfirst/_findnext on such a directory,
msvcr80d will assert.

Is there some provision for changing msvcr80d so that this assert
doesn't happen?
This is a limitation of the C-Standard not the CRT.
To handle date/times < 1900/1970 you must not use the C-Runtime.

YOu should use FindFirstFile/FindNextFile and FILETIME
full details and stack can be found at:
https://bugzilla.mozilla.org/show_bug.cgi?id=331404


And what should be the solution in the C-Runtime?

Greetings
Jochen
Mar 23 '06 #2
"Jochen Kalmbach [MVP]" <no********************@holzma.de> wrote in message
news:e6**************@TK2MSFTNGP11.phx.gbl...
Hi Josh!
It seems that windows file systems can have files dated to 1617, and
unfortunately if you call _findfirst/_findnext on such a directory,
msvcr80d will assert.

Is there some provision for changing msvcr80d so that this assert
doesn't happen?
This is a limitation of the C-Standard not the CRT.
To handle date/times < 1900/1970 you must not use the C-Runtime.

YOu should use FindFirstFile/FindNextFile and FILETIME
full details and stack can be found at:
https://bugzilla.mozilla.org/show_bug.cgi?id=331404


And what should be the solution in the C-Runtime?


It should most certainly not assert. Assertions should only catch program
errors, not exceptional conditions in the environment.

Greetings
Jochen

Mar 23 '06 #3
Hi Ben!
It should most certainly not assert. Assertions should only catch program
errors, not exceptional conditions in the environment.


asserts only happen in debug builds... and it is a good feature that it
asserts...

Greetings
Jochen
Mar 23 '06 #4
Hi Ben!
>>Is there some provision for changing msvcr80d so that this assert
doesn't happen?
This is a limitation of the C-Standard not the CRT.
To handle date/times < 1900/1970 you must not use the C-Runtime.

YOu should use FindFirstFile/FindNextFile and FILETIME
>>full details and stack can be found at:
https://bugzilla.mozilla.org/show_bug.cgi?id=331404
And what should be the solution in the C-Runtime?

It should most certainly not assert. Assertions should only catch program
errors, not exceptional conditions in the environment.
As a small addition:

The release version of the CRT never asserts.
BUT: In the VC8 CRT MS improved and extended many validation of
arguments and values inside the CRT!
Then it will crash you app (execute an breakpoint-instruction) if it
encounters some "unhandled" situation.
See "_VALIDATE_RETURN" macro.

So the following code will crash your app with the following error message:
Microsoft Visual Studio C Runtime Library has detected a fatal error in
CPP.exe.

You can verify this with the following example:

#include <windows.h>
#include <tchar.h>
#include <io.h>

int _tmain()
{
HANDLE h = CreateFile(_T("\\old.file"), GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, 0, NULL);
SYSTEMTIME st;
ZeroMemory(&st, sizeof(st));
st.wDay = 1;
st.wMonth = 1;
st.wYear = 1602;
FILETIME ft;
SystemTimeToFileTime(&st, &ft);
SetFileTime(h, &ft, &ft, &ft);
CloseHandle(h);

_finddata32_t ff;
_findfirst32("\\old.file", &ff);
}
You can only prevent this by specifying and "invalid parameter handler":

#include <windows.h>
#include <tchar.h>
#include <io.h>

void myInvalidParameterHandler(const wchar_t* expression,
const wchar_t* function,
const wchar_t* file,
unsigned int line,
uintptr_t pReserved)
{
wprintf(L"Invalid parameter detected in function %s."
L" File: %s Line: %d\n", function, file, line);
wprintf(L"Expression: %s\n", expression);
}

int _tmain()
{
HANDLE h = CreateFile(_T("\\old.file"), GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, 0, NULL);
SYSTEMTIME st;
ZeroMemory(&st, sizeof(st));
st.wDay = 1;
st.wMonth = 1;
st.wYear = 1602;
FILETIME ft;
SystemTimeToFileTime(&st, &ft);
SetFileTime(h, &ft, &ft, &ft);
CloseHandle(h);

_set_invalid_parameter_handler(myInvalidParameterH andler);

_finddata32_t ff;
_findfirst32("\\old.file", &ff);
}
But this might trigger some followup-errors, because the datetime-field
of the "ff" structure will be "NULL"...

Also there are some error, which can't be catched...
See: "SetUnhandledExceptionFilter" and VC8
http://blog.kalmbachnet.de/?postid=75

Greetings
Jochen
Dec 1 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chemix | last post by:
Hello people, I've developed a windows forms application with VC++.NET. The problem I have is the next: I run my application and all seems go OK, but passed a certain time (it can be hours or some...
2
by: SorceCode | last post by:
Hey guys, good old > Debug Assertion Failed! > File: dbgdel.cpp > Line: 47 > Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) Rears its ugly head agian! Ok heres what Im up to..
2
by: Arti Potnis | last post by:
Hi, I have an application with a function "myfunction" that opens a file and writes to it using fprintf. This application runs on a unix (sun solaris 5.8) system. I connect to this application...
4
by: A_StClaire_ | last post by:
I read a section of my text on smart "counting" pointers and found it confusing so I decided to get hands-on. however I'm getting "Debug Assertion Failed... Expression:...
2
by: marat | last post by:
I have a managed c++ function below that makes a call to an unmanaged c++ dll .. This function is called from a C# app, resulting in a "Debug Assertion Failed dbgdel.cpp Line 52 Expression:...
4
by: Mullai | last post by:
Hi , My program gives an error message like this Debug Assertion Failed! program:................ File: wincore.cpp Line: 958 Please can anyone help me out in this issue. I have to solve...
2
by: longP | last post by:
Hi I have an application which creates a queue, a thread is putting data in the queue using malloc and another thread is getting data from the queue and delete the memory allocated in the first...
0
by: Franck | last post by:
Hi, we encounter a strange error with our Access Database. It's randomly raised and looks like this : ***** Debug Assertion Failed ! Program : C:\Program Files\Microsoft...
1
by: Shrishail | last post by:
Hello Everyone, I am Transferring the data using two proxies.While transferring huge file of more than 1Gb from Client to server or Server to Client am getting the error as Debug Assertion failed...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.