Leser: 1
|< 1 2 >| | 16 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
unsigned long GetOpenFileSize(char* ss)
{
DWORD fp=0;
HANDLE a;
a=CreateFile(ss, GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if (a!=INVALID_HANDLE_VALUE)
{
fp = GetFileSize(a, NULL);
CloseHandle(a);
}
return fp;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use strict;
use constant GENERIC_READ => 0x80000000;
use constant OPEN_EXISTING => 3;
use constant FILE_ATTRIBUTE_NORMAL => 0x00000080;
use Win32::API;
use Win32::API::Struct;
Win32::API::Struct->typedef(SECURITY_ATTRIBUTES => qw{
DWORD nLength
LPVOID lpSecurityDescriptor
BOOL bInheritHandle
});
Win32::API->Import('kernel32', 'HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)');
Win32::API->Import('kernel32', 'DWORD GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)');
Win32::API->Import('kernel32', 'BOOL CloseHandle(HANDLE hObject)');
sub GetOpenFileSizeWin
{
my ($file) = @_;
my $handle = 0;
my $size = 0;
$handle = CreateFile($file, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if($handle)
{
$size = GetFileSize($handle, 0);
CloseHandle($handle);
}
return $size;
}
Can't locate object method "Pack" via package "Config" at (eval 1) line 2, <DATA> line 164
$handle = CreateFile($file, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|< 1 2 >| | 16 Einträge, 2 Seiten |