How is a variable of type Variant with value Empty represented on the stack?

故事扮演 提交于 2019-12-01 13:18:12
MC ND

VBScript variables are of type Variant. A variant represents a value that can change type. In memory, the Variant type is a 16 byte structure.

If the variable is empty (Empty value), then the vt member (that stores the type of the data referenced by the variable) will have a value of 0x0000 (VT_EMPTY)

What do you mean by stack? VBScript's virtual machine stack or the CPU stack. For theCPU stack use a debugger

You can also start in a debugger.

windbg or ntsd (ntsd is a console program and maybe installed). Both are also from Debugging Tools For Windows.

Download and install Debugging Tools for Windows

http://msdn.microsoft.com/en-us/windows/hardware/hh852363

Install the Windows SDK but just choose the debugging tools.

Create a folder called Symbols in C:\

Start Windbg. File menu - Symbol File Path and enter

srv*C:\symbols*http://msdl.microsoft.com/download/symbols

then

windbg -o -g -G c:\windows\system32\cmd.exe /k batfile.bat

All programs stop after loading but before starting to run the program. Press g to continue. Also programs stop after they finish running all code. Again press g.

You can press F12 to stop it and kb will show the call stack (g continues the program). If there's errors it will also stop and show them.

Type lm to list loaded modules, x *!* to list the symbols and bp [symbolname] to set a breakpoint.

A breakpoint is where the program stops when it encounters the BP. Allowing you to read the stack. kb shows the callstack and the first 4 parameters to the functions.

VB6

If programming in VB6 then this environmental variable link=/pdb:none stores the symbols in the dll rather than separate files. Make sure you compile the program with No Optimisations and tick the box for Create Symbolic Debug Info. Both on the Compile tab in the Project's Properties.

Also CoClassSyms (http://microsoft.com/msj/0399/hood/hood0399.aspx) can make symbols from type libraries. .

See for background https://blogs.msdn.microsoft.com/ericlippert/2004/04/19/runtime-typing-in-vbscript/

--

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!