I am trying to create an extension to wrap an existing DLL without extensive knowledge of C/++. I have used the sample extension as a base and everything seems to work fine, what I would like to do is have some error handling inside my dll.
Is there a way of sending custom errors back to dart if something inside the dll fails? Would it just be a case of sending lets say an array with the first parameter being a bool as to whether it failed or not and the second parameter being a string for the error if there is one. Or is there an actual way to throw errors from the dll itself?
Hope this made sense,
Thanks,
You should take a look inside dart_api.h file, it contains a lot of comments about Dart native stuff.
I have found Dart_ThrowException function there, but also a comment saying that Dart_NewUnhandledExceptionError should be used instead.
Both functions need a Dart exception object handle. It seems that Dart team uses their own Dart Util library to create them:
Dart_ThrowException(DartUtils::NewDartArgumentError("error message"))
Related
I’m using Intellilock in order to obfuscate and lock my SW.
I tried to use “simple” obfuscation options with following params:
and when decompiling the code (using JetBrain.dot peek) I got the following code:
Since the code IS runnable and since any idiot can understand that the second parm is the password – a breakpoint gives us the password which the SW uses in order to encrypt some files.
So I tried to check the two circled checkboxes (public types/all parameters). When Opening JetBrain.DotPeek – the result is fantastic – nothing is understandable.
But now the SW doesn’t open at all….
When looking into windows event viewer I get the following log:
.
Which means the static main couldn’t start even…
Any simple guidlines for how to normaly obfuscate my code?
Thanks!
So - I got a reply from IntelliLock support.
Obfuscating a public class requires obfuscating all dlls calling this class, such that all will get the new, obfuscated name.
So just adding all dlls is required.
I'm not sure yet [and will update hopefully] if skipping ignoring them will be sufficient.
Is it possible to modify a method body at runtime using mono embed API. Is there is a way to access method's body and signature. I know it's a little bit complicated but I really need it for a school project.
I was able to do this with the .Net framework. I found out that the .Net framework resolves all the methods at the managed code and there is an external method called SetmethodIL which I had to call using refelection and It worked but mono takes a different route. Mono takes the unmanaged code choice which calls an external method called create_runtime_class that gets the job done.
Thank you for your support.
I found out by examining the reflection_methodbuilder_to_mono_method method that a MonoMethod must have a MonoMethodHeader which contains information about the method.
At the line 3014 you will see how they were able to set the code of the method by passing the array address as a guint8.
As far as I know the code contains the CIL Instructions which is an array of bytes.
By using the method called mono_method_get_header you will be able to get the header of any method and by using technique above you will be able to modify the code. But I'm not sure if this gonna work or not It may only works with dynamically generated methods.
If you call an internal call with a byte array parameter to c Maybe we could get it right.
I created a function module and gateway service that reads data from SNAP_BEG table which is stores DUMP issues. There is no any error except that.
When I try to use link as /DumpsetSet I get
"Method 'DUMPSETSET_GET_ENTITYSET' not implemented in data provider class"
I found that how to redefine implementation but what code should I write in it? I cant find an example for this. Function module code is.
SELECT * FROM SNAP_BEG INTO TABLE ET_SNAP_BEG.
Or I just need to use something else?
What type of link should I use. I got one more project someoneelse done and I cant see difference in implementation from mine.
Edit: I can get firs record that program find by /DumpsetSet('username'). But it is not giving me all datas anyway.
Did you map the GetEntitySet to a data source from SEGW - SAP Gateway Service Builder, under the Service Implementation part. After this operation you should generate runtime objects.
There is a good blog for this, here.
Ok so i'v been starting to learn kotlin for a week now, and i love the language:p
Besides the great utility of extension function, i feel like they lack a proper way of creating namespaces like java utility classes (xxxUtil).
I have recently starting to use this aproach, which im not sure is the right one, and i would like some feedback from Kotlin experienced users.
Is this a valid and proper thing todo:
object RealmDb {
private val realmInstance by lazy{ Realm.getInstance(MainApplication.instance) }
private fun wrapInTransaction(code:() -> Unit){
realmInstance.beginTransaction();
code.invoke()
realmInstance.commitTransaction();
}
object NormaNote{
fun create(...) {...}
fun update(...) {...}
}
}
So, whenever i want to update some NormalNote value to a Realm Database, i do the following:
RealmDb.NormaNote.create(title.text.toString(), note.text.toString())
Is this a common thing to do? Are there better approaches? As i understood, this is singleton nesting, i don't think there's any problem with this, i just don't like to put this common things like DB operations inside classes that need to be instantiated. In old java i opted to static classes
The officially recommended way to create namespaces in Kotlin is to put properties and functions that don't need to be inside classes at the top level of the file, and to use the package statements to create a namespace hierarchy. We see the practice of creating utility classes in Java as a workaround for a deficiency in the language, and not as a good practice to be followed in other languages.
In your example, I would put all of the code in top-level functions and properties.
I don't know about the rest of the code, but I do know that you don't have to call .invoke () on code. The invoke method can always be shortened to a direct call, which in this case would be code ().
I have a WPF project. When I add a class and a method, and write "this.", I get no intellisense. There is a message in the bottom tab of Visual Studio that an identifier is expected, but that doesn't make sense.
Furthermore, I can't access some methods/objects. Take the following example:
DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb");
When I try to access the variable, no intellisense comes up (get the same message about an identifier).
Does anyone know why this? To make things worse, I have this problem too: http://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/thread/701934bc-5237-40df-aa54-f768debf4e59
Thanks
Is your class or method static? If so, you won't be able to call any instance members or properties using the "this" keyword. If you want to use members or properties in static methods, they have to be static too.
In my experience Intellisense fails often when the code for the class that you are writing does not compile. So, the cause might be a syntax error in a different line of code or an absent project reference, or using statement.
I cannot help you with the error link you gave. As this sure means that WPF form does not compile, it follows that Intellisense does not work.
Have you tried to restart Visual Studio, I have seen issues with its intellisense like that. If you just go ahead and use the instance, does it compile, if so probably just have to restart the application.
Using "this" if the class is static, the this identifier will not work.
I just typed your exact code in my instance of VS2008 and I got intellisense.