亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? api.pm

?? WIN32::API for perl dev 5.7
?? PM
字號:
package Win32::API;

# See the bottom of this file for the POD documentation.  Search for the
# string '=head'.

#######################################################################
#
# Win32::API - Perl Win32 API Import Facility
# 
# Version: 0.20 
# Date: 24 Oct 2000
# Author: Aldo Calpini <dada@perl.it>
#######################################################################

require Exporter;       # to export the constants to the main:: space
require DynaLoader;     # to dynuhlode the module.
@ISA = qw( Exporter DynaLoader );

#######################################################################
# This AUTOLOAD is used to 'autoload' constants from the constant()
# XS function.  If a constant is not found then control is passed
# to the AUTOLOAD in AutoLoader.
#

sub AUTOLOAD {
    my($constname);
    ($constname = $AUTOLOAD) =~ s/.*:://;
    #reset $! to zero to reset any current errors.
    $!=0;
    my $val = constant($constname, @_ ? $_[0] : 0);
    if ($! != 0) {
        if ($! =~ /Invalid/) {
            $AutoLoader::AUTOLOAD = $AUTOLOAD;
            goto &AutoLoader::AUTOLOAD;
        } else {
            ($pack,$file,$line) = caller;
            die "Your vendor has not defined Win32::API macro $constname, used at $file line $line.";
        }
    }
    eval "sub $AUTOLOAD { $val }";
    goto &$AUTOLOAD;
}


#######################################################################
# STATIC OBJECT PROPERTIES
#
$VERSION = "0.20";

# some package-global hash to 
# keep track of the imported 
# libraries and procedures
%Libraries = ();
%Procedures = ();

#######################################################################
# dynamically load in the API extension module.
#
bootstrap Win32::API;

#######################################################################
# PUBLIC METHODS
#
sub new {
    my($class, $dll, $proc, $in, $out) = @_;
    my $hdll;   
    my $self = {};
  
    # avoid loading a library more than once
    if(exists($Libraries{$dll})) {
        # print "Win32::API::new: Library '$dll' already loaded, handle=$Libraries{$dll}\n";
        $hdll = $Libraries{$dll};
    } else {
        # print "Win32::API::new: Loading library '$dll'\n";
        $hdll = Win32::API::LoadLibrary($dll);
        $Libraries{$dll} = $hdll;
    }

    # if the dll can't be loaded, set $! to Win32's GetLastError()
    if(!$hdll) {
        $! = Win32::GetLastError();
        return undef;
    }

    # first try to import the function of given name...
    my $hproc = Win32::API::GetProcAddress($hdll, $proc);

    # ...then try appending either A or W (for ASCII or Unicode)
    if(!$hproc) {
        $proc .= (IsUnicode() ? "W" : "A");
        # print "Win32::API::new: procedure not found, trying '$proc'...\n";
        $hproc = Win32::API::GetProcAddress($hdll, $proc);
    }

    # ...if all that fails, set $! accordingly
    if(!$hproc) {
        $! = Win32::GetLastError();
        return undef;
    }
    
    # ok, let's stuff the object
    $self->{dll} = $hdll;
    $self->{dllname} = $dll;
    $self->{proc} = $hproc;

	my @in_params = ();
	if(ref($in) eq 'ARRAY') {
		foreach (@$in) {
			push(@in_params, 1) if /[NL]/i;
			push(@in_params, 2) if /P/i;
			push(@in_params, 3) if /I/i;        
			push(@in_params, 4) if /F/i;
			push(@in_params, 5) if /D/i;
			push(@in_params, 22) if /B/i;
			push(@in_params, 101) if /C/i;
		}	
	} else {
		my @in = split '', $in;
		foreach (@in) {
			push(@in_params, 1) if /[NL]/i;
			push(@in_params, 2) if /P/i;
			push(@in_params, 3) if /I/i;        
			push(@in_params, 4) if /F/i;
			push(@in_params, 5) if /D/i;
			push(@in_params, 22) if /B/i;
			push(@in_params, 101) if /C/i;
		}			
	}
	$self->{in} = \@in_params;

    if($out =~ /[NL]/i) {
        $self->{out} = 1;
    } elsif($out =~ /P/i) {
        $self->{out} = 2;
    } elsif($out =~ /I/i) {
        $self->{out} = 3;
    } elsif($out =~ /F/i) {
        $self->{out} = 4;
    } elsif($out =~ /D/i) {
        $self->{out} = 5;
    } else {
        $self->{out} = 0;
    }

    # keep track of the imported function
    $Libraries{$dll} = $hdll;
    $Procedures{$dll}++;

    # cast the spell
    bless($self, $class);
    return $self;
}


#######################################################################
# PRIVATE METHODS
#
sub DESTROY {
    my($self) = @_;

    # decrease this library's procedures reference count
    $Procedures{$self->{dllname}}--;

    # once it reaches 0, free it
    if($Procedures{$self->{dllname}} == 0) {
        # print "Win32::API::DESTROY: Freeing library '$self->{dllname}'\n";
        Win32::API::FreeLibrary($Libraries{$self->{dllname}});
        delete($Libraries{$self->{dllname}});
    }    
}

#Currently Autoloading is not implemented in Perl for win32
# Autoload methods go after __END__, and are processed by the autosplit program.

1;
__END__


=head1 NAME

Win32::API - Perl Win32 API Import Facility

=head1 SYNOPSIS

  use Win32::API;
  $function = new Win32::API(
      $library, $functionname, \@argumenttypes, $returntype,
  );
  $return = $function->Call(@arguments);

=head1 ABSTRACT

With this module you can import and call arbitrary functions
from Win32's Dynamic Link Libraries (DLL), without having
to write an XS extension. Note, however, that this module 
can't do anything (parameters input and output is limited 
to simpler cases), and anyway a regular XS extension is
always safer and faster. 

The current version of Win32::API is available at my website:

  http://dada.perl.it/

It's also available on your nearest CPAN mirror (but allow a few days 
for worldwide spreading of the latest version) reachable at:

  http://www.perl.com/CPAN/authors/Aldo_Calpini/

A short example of how you can use this module (it just gets the PID of 
the current process, eg. same as Perl's internal C<$$>):

    use Win32::API;
    $GetPID = new Win32::API("kernel32", "GetCurrentProcessId", '', 'N');
    $PID = $GetPID->Call();

The possibilities are nearly infinite (but not all are good :-).
Enjoy it.


=head1 CREDITS

All the credits go to Andrea Frosini 
for the neat assembler trick that makes this thing work.
A big thank you also to Gurusamy Sarathy for his
unvaluable help in XS development, and to all the Perl community for
being what it is.


=head1 DESCRIPTION

To use this module put the following line at the beginning of your script:

    use Win32::API;

You can now use the C<new()> function of the Win32::API module to create a
new API object (see L<IMPORTING A FUNCTION>) and then invoke the 
C<Call()> method on this object to perform a call to the imported API
(see L<CALLING AN IMPORTED FUNCTION>).

=head2 IMPORTING A FUNCTION

You can import a function from a 32 bit Dynamic Link Library (DLL) file 
with the C<new()> function. This will create a Perl object that contains the
reference to that function, which you can later C<Call()>.
You need to pass 4 parameters:

=over 4

=item 1.
The name of the library from which you want to import the function.

=item 2.
The name of the function (as exported by the library).

=item 3.
The number and types of the arguments the function expects as input.

=item 4.
The type of the value returned by the function.

=back

To better explain their meaning, let's suppose that we
want to import and call the Win32 API C<GetTempPath()>.
This function is defined in C as:

    DWORD WINAPI GetTempPathA( DWORD nBufferLength, LPSTR lpBuffer );

This is documented in the B<Win32 SDK Reference>; you can look
for it on the Microsoft's WWW site, or in your C compiler's 
documentation, if you own one.

=over 4

=item B<1.>

The first parameter is the name of the library file that 
exports this function; our function resides in the F<KERNEL32.DLL>
system file.
When specifying this name as parameter, the F<.DLL> extension
is implicit, and if no path is given, the file is searched through
a couple of directories, including: 

=over 4

=item 1. The directory from which the application loaded. 

=item 2. The current directory. 

=item 3. The Windows system directory (eg. c:\windows\system or system32).

=item 4. The Windows directory (eg. c:\windows).

=item 5. The directories that are listed in the PATH environment variable. 

=back

So, you don't have to write F<C:\windows\system\kernel32.dll>; 
only F<kernel32> is enough:

    $GetTempPath = new Win32::API('kernel32', ...

=item B<2.>

Now for the second parameter: the name of the function.
It must be written exactly as it is exported 
by the library (case is significant here). 
If you are using Windows 95 or NT 4.0, you can use the B<Quick View> 
command on the DLL file to see the function it exports. 
Remember that you can only import functions from 32 bit DLLs:
in Quick View, the file's characteristics should report
somewhere "32 bit word machine"; as a rule of thumb,
when you see that all the exported functions are in upper case,
the DLL is a 16 bit one and you can't use it. 
If their capitalization looks correct, then it's probably a 32 bit
DLL.

Also note that many Win32 APIs are exported twice, with the addition of
a final B<A> or B<W> to their name, for - respectively - the ASCII 
and the Unicode version.
When a function name is not found, Win32::API will actually append
an B<A> to the name and try again; if the extension is built on a
Unicode system, then it will try with the B<W> instead.
So our function name will be:

    $GetTempPath = new Win32::API('kernel32', 'GetTempPath', ...

In our case C<GetTempPath> is really loaded as C<GetTempPathA>.

=item B<3.>

The third parameter, the input parameter list, specifies how many 
arguments the function wants, and their types. It can be passed as
a single string, in which each character represents one parameter, 
or as a list reference. The following forms are valid:

    "abcd"
    [a, b, c, d]
    \@LIST

But those are not:

    (a, b, c, d)
    @LIST

The number of characters, or elements in the list, specifies the number 
of parameters, and each character or element specifies the type of an 
argument; allowed types are:

=over 4

=item C<I>: 
value is an integer

=item C<N>: 
value is a number (long)

=item C<F>: 
value is a floating point number (float)

=item C<D>: 
value is a double precision number (double)

=item C<P>: 
value is a pointer (to a string, structure, etc...)

=back

Our function needs two parameters: a number (C<DWORD>) and a pointer to a 
string (C<LPSTR>):

    $GetTempPath = new Win32::API('kernel32', 'GetTempPath', 'NP', ...

=item B<4.>

The fourth and final parameter is the type of the value returned by the 
function. It can be one of the types seen above, plus another type named B<V> 
(for C<void>), used for functions that do not return a value.
In our example the value returned by GetTempPath() is a C<DWORD>, so 
our return type will be B<N>:

    $GetTempPath = new Win32::API('kernel32', 'GetTempPath', 'NP', 'N');

Now the line is complete, and the GetTempPath() API is ready to be used
in Perl. Before calling it, you should test that $GetTempPath is 
C<defined>, otherwise either the function or the library could not be
loaded; in this case, C<$!> will be set to the error message reported 
by Windows.
Our definition, with error checking added, should then look like this:

    $GetTempPath = new Win32::API('kernel32', 'GetTempPath', 'NP', 'N');
    if(not defined $GetTempPath) {
        die "Can't import API GetTempPath: $!\n";
    }

=back

=head2 CALLING AN IMPORTED FUNCTION

To effectively make a call to an imported function you must use the
Call() method on the Win32::API object you created.
Continuing with the example from the previous paragraph, 
the GetTempPath() API can be called using the method:

    $GetTempPath->Call(...

Of course, parameters have to be passed as defined in the import phase.
In particular, if the number of parameters does not match (in the example,
if GetTempPath() is called with more or less than two parameters), 
Perl will C<croak> an error message and C<die>.

The two parameters needed here are the length of the buffer
that will hold the returned temporary path, and a pointer to the 
buffer itself.
For numerical parameters, you can use either a constant expression
or a variable, while B<for pointers you must use a variable name> (no 
Perl references, just a plain variable name).
Also note that B<memory must be allocated before calling the function>,
just like in C.
For example, to pass a buffer of 80 characters to GetTempPath(),
it must be initialized before with:

    $lpBuffer = " " x 80;

This allocates a string of 80 characters. If you don't do so, you'll
probably get C<Runtime exception> errors, and generally nothing will 
work. The call should therefore include:

    $lpBuffer = " " x 80;
    $GetTempPath->Call(80, $lpBuffer);

And the result will be stored in the $lpBuffer variable.
Note that you don't need to pass a reference to the variable
(eg. you B<don't need> C<\$lpBuffer>), even if its value will be set 
by the function. 

A little problem here is that Perl does not trim the variable, 
so $lpBuffer will still contain 80 characters in return; the exceeding 
characters will be spaces, because we said C<" " x 80>.

In this case we're lucky enough, because the value returned by 
the GetTempPath() function is the length of the string, so to get
the actual temporary path we can write:

    $lpBuffer = " " x 80;
    $return = $GetTempPath->Call(80, $lpBuffer);
    $TempPath = substr($lpBuffer, 0, $return);

If you don't know the length of the string, you can usually
cut it at the C<\0> (ASCII zero) character, which is the string
delimiter in C:

    $TempPath = ((split(/\0/, $lpBuffer))[0];
    
    # or
    
    $lpBuffer =~ s/\0.*$//;

Another note: to pass a pointer to a structure in C, you have
to pack() the required elements in a variable. And of course, to 
access the values stored in a structure, unpack() it as required.
A short example of how it works: the C<POINT> structure is defined 
in C as:

    typedef struct {
        LONG  x;
        LONG  y;
    } POINT;

Thus, to call a function that uses a C<POINT> structure you
need the following lines:

    $GetCursorPos = new Win32::API('user32', 'GetCursorPos', 'P', 'V');
    
    $lpPoint = pack('LL', 0, 0); # store two LONGs
    $GetCursorPos->Call($lpPoint);
    ($x, $y) = unpack('LL', $lpPoint); # get the actual values

The rest is left as an exercise to the reader...


=head1 AUTHOR

Aldo Calpini ( I<dada@perl.it> ).

=cut


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产99久久久国产精品潘金| 午夜精品久久一牛影视| 日韩视频一区二区| 欧美日韩国产另类一区| 欧美日韩国产小视频| 欧美色视频一区| 欧美丰满美乳xxx高潮www| 欧美午夜一区二区三区| 欧美手机在线视频| 日韩欧美一区二区三区在线| 制服丝袜中文字幕一区| 日韩精品综合一本久道在线视频| 日韩写真欧美这视频| 欧美成人高清电影在线| 久久久www成人免费无遮挡大片| 久久久三级国产网站| 欧美国产欧美综合| 成人免费在线播放视频| 亚洲成人av资源| 捆绑调教美女网站视频一区| 国产传媒一区在线| av亚洲精华国产精华精| 欧美视频完全免费看| 亚洲精品一区二区三区香蕉| 欧美成va人片在线观看| 国产女人水真多18毛片18精品视频| 欧美激情一二三区| 亚洲精品伦理在线| 视频一区中文字幕国产| 国产在线播放一区二区三区| 成人黄色软件下载| 7777精品伊人久久久大香线蕉超级流畅| 欧美片网站yy| 欧美激情资源网| 一区二区三区在线观看欧美| 久久国产日韩欧美精品| 91亚洲精华国产精华精华液| 不卡大黄网站免费看| 欧美精品色一区二区三区| 中文字幕视频一区二区三区久| 蜜臀av性久久久久av蜜臀妖精| 一本到不卡免费一区二区| 26uuu亚洲综合色欧美| 美女脱光内衣内裤视频久久影院| 色猫猫国产区一区二在线视频| 国产蜜臀av在线一区二区三区| 久久99精品一区二区三区| 欧美精品九九99久久| 捆绑紧缚一区二区三区视频| 精品日韩一区二区三区免费视频| 久久66热偷产精品| 久久综合色一综合色88| 国产成人一区二区精品非洲| 一区二区三区在线观看欧美| 成人综合在线观看| 国产98色在线|日韩| 视频在线观看一区| 美女视频黄频大全不卡视频在线播放| 精品国产自在久精品国产| 精品日本一线二线三线不卡| 国产亚洲婷婷免费| 成人涩涩免费视频| 天天色综合成人网| 国产一区二区在线观看免费| 欧美性大战xxxxx久久久| 99精品视频一区| 日韩欧美亚洲一区二区| 天堂在线亚洲视频| 在线观看91视频| 亚洲六月丁香色婷婷综合久久 | 亚洲老妇xxxxxx| av在线播放成人| 国产精品网站在线| 国产成人日日夜夜| 国产日韩av一区二区| 国产一区在线看| 精品电影一区二区| 国产乱妇无码大片在线观看| 日韩欧美的一区二区| 毛片av一区二区三区| 欧美电视剧在线看免费| 免费不卡在线视频| 日韩欧美一区在线| 久久精品国产精品亚洲精品| 欧美变态tickle挠乳网站| 美女精品自拍一二三四| 欧美大尺度电影在线| 久久99国产精品尤物| 久久综合成人精品亚洲另类欧美 | 欧美精品v日韩精品v韩国精品v| 国产精品成人一区二区艾草| voyeur盗摄精品| 中文字幕一区二区不卡| 91豆麻精品91久久久久久| 一区二区三区在线免费观看| 在线观看免费视频综合| 日韩主播视频在线| 日韩精品专区在线影院观看| 国产最新精品免费| 亚洲欧洲国产日韩| 欧美色图在线观看| 国产资源在线一区| 亚洲欧美偷拍卡通变态| 欧美日韩一区三区四区| 激情欧美一区二区| 中文字幕中文字幕中文字幕亚洲无线 | 一区二区三区欧美| 7878成人国产在线观看| 国产.欧美.日韩| 精品亚洲免费视频| 亚洲婷婷在线视频| 欧美一区二区三区在| 成人a免费在线看| 青青草成人在线观看| 国产喂奶挤奶一区二区三区| 色综合天天性综合| 国产在线国偷精品免费看| 樱花草国产18久久久久| 日韩一卡二卡三卡国产欧美| 99麻豆久久久国产精品免费优播| 日韩av电影一区| 最新热久久免费视频| 欧美一区二区成人| 一本大道久久精品懂色aⅴ| 蜜桃av一区二区在线观看 | 在线视频欧美精品| 国产成人自拍高清视频在线免费播放| 亚洲图片一区二区| 国产精品久久久久久久岛一牛影视| 欧美精品久久99| 日本韩国视频一区二区| 国产成人精品影视| 麻豆精品新av中文字幕| 亚洲国产cao| 亚洲欧美视频在线观看| 国产情人综合久久777777| 在线91免费看| 欧美日韩免费观看一区二区三区 | 亚洲一区二区美女| 国产精品美女一区二区三区| 日韩精品一区二区三区四区| 欧美剧情电影在线观看完整版免费励志电影 | 欧美va亚洲va| 欧美嫩在线观看| 91香蕉视频在线| gogo大胆日本视频一区| 高清av一区二区| 国产成人超碰人人澡人人澡| 久久se这里有精品| 久久精品噜噜噜成人88aⅴ| 日韩国产在线观看一区| 视频一区在线播放| 奇米888四色在线精品| 日韩av一级电影| 日韩精品一卡二卡三卡四卡无卡| 午夜在线电影亚洲一区| 一区二区久久久久久| 一个色妞综合视频在线观看| 日韩理论片中文av| 伊人开心综合网| 亚洲一区二区三区激情| 日韩高清欧美激情| 国产在线精品不卡| 不卡av免费在线观看| 色综合色综合色综合| 欧美日韩国产高清一区二区| 欧美一区二区免费视频| 久久色在线观看| 自拍偷拍国产精品| 亚洲国产精品久久一线不卡| 免费成人在线观看视频| 国产剧情一区二区三区| 99re这里只有精品6| 欧美精品九九99久久| 久久男人中文字幕资源站| 国产精品久久久久久久久免费相片 | 精品一区二区三区在线播放视频 | 国产精品乱码人人做人人爱 | 91蜜桃婷婷狠狠久久综合9色| 91福利国产精品| 91精品国产综合久久久蜜臀图片| 亚洲精品一区二区三区蜜桃下载 | 亚洲免费观看高清在线观看| 亚洲欧美成aⅴ人在线观看| 亚洲特黄一级片| 人妖欧美一区二区| 狠狠狠色丁香婷婷综合久久五月| 国产又黄又大久久| 色偷偷一区二区三区| 在线免费观看日本欧美| 制服丝袜亚洲网站| 国产精品麻豆99久久久久久| 亚洲女同ⅹxx女同tv| 国产一区二区三区综合| 九九精品视频在线看| 99久久精品久久久久久清纯| 日韩一区二区三区视频在线观看| 久久久一区二区三区捆绑**| 亚洲国产成人精品视频| 九九九精品视频|