Giter Site home page Giter Site logo

ExVar.getVar returning wrong value about conari HOT 4 CLOSED

3f avatar 3f commented on May 13, 2024
ExVar.getVar returning wrong value

from conari.

Comments (4)

3F avatar 3F commented on May 13, 2024

Hello @SapientGuardian

std::cin is not actually a variable (at least for ExVar context) and in general assumes working with streams.
ExVar was just designed for other purposes such as final data as variables or some other const data in memory.

That is,

00007FF844A06070 -> 00007ff8449db0d0  -> data
                    ^^^^^^^^^^^^^^^^
                    final value at this pointer

See details in #7 and 3F/DllExport#24

Logic of the getVar above was based on getField + our Conari 'native' extension:

-> getField
v
-> -> provider
        .Svc
        .native(lpProcName)
        .t(type)
        .Raw.Type.FirstField;

Therefore it will return an wrong pointer because ExVar feature already calculated this as final data by jumping "forward".

I don't remember exactly but more like we don't have special logic for any streams and similar cases in 1.4.
Although for 1.4 you can try at least this:

var cin = l.Svc.getProcAddr(l.Svc.procName("?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A", false));
// now a correct pointer to std::cin stream

I think we need a more elegant ~"Conari way".

But I still can't talk anything specific about some changes/new features/or some releases at least from me due to my health problems and more; However I can try to coordinate some work around my projects and their releases if someone be ready for something.

Thanks for using. Yours,
-- Denis Kuzmin

from conari.

3F avatar 3F commented on May 13, 2024

FYI don't forget about aliases which are super useful for C++ (the case of #3). For example:

l.Aliases.Add("cin", "?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A");

then it could be like

_v1 = l.ExVar.DLR.cin<IntPtr>();
_v2 = l.ExVar.get<IntPtr>("cin");
// ...
l.ExVar.get<IntPtr>("class std::basic_istream<char,struct std::char_traits<char>> std::cin");
etc.

from conari.

SapientGuardian avatar SapientGuardian commented on May 13, 2024

Thank you for your insights; the getProcAddr method you suggested works perfectly!

from conari.

3F avatar 3F commented on May 13, 2024

Conari 1.5 now provides IProvider.addr()

Use it easier,

l.addr("...")

Also note the following,

l.Svc.getProcAddr("...")
l.Svc.native("...")

from conari.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.