Waitrud Weber’s blog

things and reminders for memories

WindowsAPI: about LPFILETIME

LPFILETIME is even a pointer.

I used GetFileTime which returned 3 bytes as maybe FILETIME to LPFILETIME.

 

 

> .\copy_001.exe
creationtime: 14749440
lp_creationtime: 0
lp_creationtime_256: 14750232
n   0: cn:  40
n   1: cn: 113
n   2: cn: -31
n   0: cn:  40
n   1: cn: 113
n   2: cn: -31

about LPFILETIME.

    .\copy_001.cpp
  1 :#include
  2 :#include
  3 ://#include
  4 :#include 
  5 :// x #include 
  6 :
  7 :#include "array_counter.h"
  8 :#include "sender.h"
  9 :#include "Print.h"
 10 :#include "aDebug.h"
 11 :#include "list_directory.h"
 12 :#include "parse.h"
 13 :
 14 :int sum(int, ...);
 15 :int file_open( char* char_filename ) ;
 16 :char* file_all_open( char* char_filename ) ;
 17 :int filesize( FILE *fp ) ;
 18 :int file_list_main(int argc, char **argv) ;
 19 :
 20 :void print_chars( char* char_string) ;
 21 :
 22 :
 23 ://
 24 ://
 25 ://
 26 ://
 27 ://
 28 :int main(int argc, char **argv) {
 29 :
 30 :	int success = 0;
 31 :	char* creationtime = nullptr;
 32 :	char* updatetime = nullptr;
 33 :	char* accesstime = nullptr;
 34 :
 35 :	BOOL b_success = 0;
 36 :	HANDLE hTime = INVALID_HANDLE_VALUE;
 37 :	LPFILETIME lp_creationtime;
 38 :	LPFILETIME lp_updatetime;
 39 :	LPFILETIME lp_accesstime;
 40 :	WIN32_FIND_DATA ffd;
 41 :	LPFILETIME lp_updatetime_256;
 42 :	LPFILETIME lp_accesstime_256;
 43 :	LPFILETIME lp_creationtime_256;
 44 :
 45 :	creationtime = char_string( 256 );
 46 :	updatetime = char_string( 256 );
 47 :	accesstime = char_string( 256 );
 48 :
 49 :	lp_creationtime_256 = (LPFILETIME)char_string( 256 );
 50 :	lp_updatetime_256   = (LPFILETIME)char_string( 256 );
 51 :	lp_accesstime_256   = (LPFILETIME)char_string( 256 );
 52 :
 53 :	hTime = FindFirstFile( copyof("C:\\Users\\soresore soreda\\source-002\\aDebug.cpp"), &ffd );
 54 :
 55 :
 56 :	b_success = GetFileTime(  hTime, (LPFILETIME)creationtime, (LPFILETIME)accesstime, (LPFILETIME)updatetime );
 57 :	b_success = GetFileTime(  hTime, lp_creationtime, lp_accesstime, lp_updatetime );
 58 :
 59 :	// x printf( "lp_creationtime: %d: %d\r\n", lp_creationtime, *lp_creationtime);
 60 :	// x printf( "lp_creationtime: %d: %d\r\n", creationtime, *creationtime);
 61 :	printf( "creationtime: %d\r\n", creationtime);
 62 :	printf( "lp_creationtime: %d\r\n", lp_creationtime);
 63 :	printf( "lp_creationtime_256: %d\r\n", lp_creationtime_256);
 64 :
 65 :	print_chars(creationtime);
 66 :	print_chars((char *)lp_creationtime_256);
 67 :
 68 :	return 0;
 69 :}
 70 :
 71 :void print_chars( char* char_string) {
 72 :
 73 :	for( int i=0; 1; i++ ) {
 74 :		if ( char_string[i] == '\0' ) break;
 75 :		printf("n %3d: cn: %3d \r\n", i, char_string[i]);
 76 :	}
 77 :
 78 :}
 79 :