winapi - SetFileTime() behaving strangeley -



winapi - SetFileTime() behaving strangeley -

the windows function setfiletime() in company's application behaving anomalously in 2 ways:

a.) in 1 case, i'm trying update date times (access, create, modify) of file "01/01/1980 00:00:00" , file winds having original date times removed.

b.) in case, file have create , modified date updated seemingly random date time "march ‎17, ‎1817, ‏‎6:26:56 am". 1 not replicable - same file can update fine if seek subsequent times.

please advise/assist.

in both cases, update beingness done remotely - files reside on different server. language mfc c++

code below:

cstring cstime; coledatetime tcreate, taccess, tmodify; systemtime stcreate, staccess, stmodify; filetime ftcreate, ftaccess, ftmodify; cstime = pmeta->get( _t("createtime") ); if ( !cstime.isempty() ) tcreate.parsedatetime( cstime, 0ul, 1033 ); else tcreate = coledatetime::getcurrenttime(); tcreate.getassystemtime( stcreate ); bool stbool = systemtimetofiletime( &stcreate, &ftcreate ); cstime = pmeta->get( _t("modifytime") ); if ( !cstime.isempty() ) tmodify.parsedatetime( cstime, 0ul, 1033 ); else tmodify = coledatetime::getcurrenttime(); tmodify.getassystemtime( stmodify ); bool stbool2 = systemtimetofiletime( &stmodify, &ftmodify ); cstime = pmeta->get( _t("accesstime") ); if ( !cstime.isempty() ) taccess.parsedatetime( cstime, 0ul, 1033 ); else taccess = coledatetime::getcurrenttime(); taccess.getassystemtime( staccess ); bool stbool3 = systemtimetofiletime( &staccess, &ftaccess ); // write mac times handle htarget = createfile( cstest, generic_read|generic_write, file_share_read, null, open_existing, file_attribute_normal, null ); bool winapi = setfiletime( htarget, &ftcreate, &ftaccess, &ftmodify ); closehandle( htarget );

winapi mfc

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -