AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Generating unique random integers
Goto page Previous  1, 2, 3, 4, 5, 6
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Fri Jul 25, 2008 11:39 pm    Post subject: Reply with quote

ell wrote:
how I set the 'AND' of A and B to C ?
Setup C as shown for A, or B, with its buffer z. Replace the line
Code:
NumPut(NumGet(&x-1,A_Index,"UChar") & NumGet(&y-1,A_Index,"UChar"), &x-1, A_Index, "UChar")
with
Code:
NumPut(NumGet(&x-1,A_Index,"UChar") | NumGet(&y-1,A_Index,"UChar"), &z-1, A_Index, "UChar")
(The bitwise AND is ‘&’, replaced here with the bitwise OR: ‘|’, providing the union of the two bitmaps A and B in the bitmap C.)
ell wrote:
SET bitmap vars one to other… C := A
Replace the above line with
Code:
NumPut(NumGet(&x-1,A_Index,"UChar"), &z-1, A_Index, "UChar")
ell wrote:
on the 128mb bitmap var,
I can make same commands as you posted on your 'AND' example ?
what is the number I set as bitmap var capacity of 1GB ?
It should work with any size, up to 2GB. 32-bit Windows versions do not handle more. When the physical memory is exhausted, parts of the bitmap will be swapped to disk, which is very slow.
Back to top
View user's profile Send private message
rani



Joined: 18 Mar 2008
Posts: 95

PostPosted: Mon Sep 29, 2008 10:15 pm    Post subject: ntdll bitmaps Reply with quote

Hi Laslo

I checked in ahk and later in vb6 the ntdll bit search 'or' and 'and'
and itterate on or bits=1 in specififc ntdll
of course in ahk it was real slow.
but in VB6 I expected for much better response (immeditely)

if I want to use in my application hundreds( or even thousands)
of bitmap strings , using ntdll
how I can handle these bitmaps ?
putting all in memory in some pointer array ?

or is there some other technique to handle it ?
some internal 'database' or else ?

rgrds
rani
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Mon Sep 29, 2008 10:47 pm    Post subject: Reply with quote

When you create the bitmaps, you have to give them a name (an AHK variable, which contains the bitmap structure) and reserve memory for the data (other AHK variables, with the necessary VarSetCapacity calls). These variables can be array elements:
Code:
Number_of_Bits = 66 ; whatever you need
Size_in_Bytes := ceil(Number_of_Bits/8)

Loop 999 {
   VarSetCapacity(Bitmap%A_Index%, 8, 0) ; Bitmap header always 8 bytes
   VarSetCapacity(Buffer%A_Index%, Size_in_Bytes, 0) ; Bitmap buffer
   DllCall("ntdll\RtlInitializeBitMap", UInt, &Bitmap%A_Index%, UInt, &Buffer%A_Index%, UInt, Number_of_Bits)
}


Edit: fixed typo


Last edited by Laszlo on Wed Oct 22, 2008 2:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
rani



Joined: 18 Mar 2008
Posts: 95

PostPosted: Wed Oct 08, 2008 11:28 am    Post subject: ntdll instance Reply with quote

Hi Laso,

1.
I checked the array in VB6 , and it works.

2.
is it possible to make one instance of the array of bitmap strings (thousand's)
and in other tasks (PID threads) to get /set values to this array ?
to aviod loading all array in every task opened ?
how is the technique to do that ?
by COM/DCOM maybe ?
any code sample will help
3.
is it possible to make ahk script to wrap under COM object ?
so it will be treated ad activex dll ?

thanks
ran
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Wed Oct 08, 2008 12:54 pm    Post subject: Reply with quote

look here
Back to top
View user's profile Send private message
rani



Joined: 18 Mar 2008
Posts: 95

PostPosted: Thu Oct 09, 2008 7:43 pm    Post subject: Reply with quote

Hi Laslo

I read your link but I could not connect how to use the ntdll functions
with the rea/write memory

ran
Back to top
View user's profile Send private message
rani



Joined: 18 Mar 2008
Posts: 95

PostPosted: Sat Oct 11, 2008 5:48 am    Post subject: Reply with quote

Hi Laslo

is it possible to wrap ahk script
as COM activex object ?
so other program can use it as DLL instance ?

rgrds
ran
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Sat Oct 11, 2008 1:49 pm    Post subject: Reply with quote

Ask (PM) a COM expert, like Sean or Lexikos.
Back to top
View user's profile Send private message
rani



Joined: 18 Mar 2008
Posts: 95

PostPosted: Wed Oct 22, 2008 4:51 am    Post subject: Reply with quote

Hi Laszo

when I initialize the bitmap,
I want the max bits will be ,let say 500,000 or 1MB bits:
bits=500000
what is the number I set in the :
DllCall("ntdll\RtlInitializeBitMap"

it is in bits or bytes ? or k*32 ?
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Wed Oct 22, 2008 2:33 pm    Post subject: Reply with quote

The last parameter is the number of bits.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6
Page 6 of 6

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group