Writing a privileged helper tool with SMJobBless()

XPC isn’t an option if you’re trying to elevate privileges (from https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingXPCServices.html): By default, XPC services are run in the most restricted environment possible—sandboxed with minimal filesystem access, network access, and so on. Elevating a service’s privileges to root is not supported. SMJobBless will install a helper tool and register it with Launchd, as in … Read more

passing a struct over TCP (SOCK_STREAM) socket in C

You need the following to portably send struct’s over the network: Pack the structure. For gcc and compatible compilers, do this with __attribute__((packed)). Do not use any members other than unsigned integers of fixed size, other packed structures satisfying these requirements, or arrays of any of the former. Signed integers are OK too, unless your … Read more

Sharing same variable between more than one independent programs in Linux [closed]

Variables you declare in your headers will generate a copy where ever you include them (unless you declare them extern). Of course, when dealing with separate processes every process will have its own memory space. You need to use more sophisticated techniques to circumvent this, i.e. Inter Process Communication (IPC). For example: (named) Pipes Sockets … Read more

Delphi 2009: How to communicate between Windows service & desktop application under Vista?

The way to go is named pipes, you’ll probably have to take a look at the communication across different Integrity levels. This article explores how to do this in vista. Although it’s written in c++ it’s just basic Windows API calls, so it should translate fast enough to Delphi. If you want to search for … Read more

Simplest way to make cross-appdomain call?

If you created an object in another domain e.g. with AppDomain.CreateInstanceAndUnwrap, all you need to call the object in another domain is to call an object’s method. The simplest way to make a cross-application domain call is just to make a call directly on that object, which actually is exposed from another domain via its … Read more

Is it better to use TThread’s “Synchronize” or use Window Messages for IPC between main and child thread?

Edit: It looks like many of the implementation details have changed since Delphi 4 and 5 (the Delphi versions I’m still using for most of my work), and Allen Bauer has commented the following: Ever since D6, TThread doesn’t use SendMessage anymore. It uses a thread-safe work queue where the “work” intended for the main … Read more

Combining node.js and Python

This sounds like a scenario where zeroMQ would be a good fit. It’s a messaging framework that’s similar to using TCP or Unix sockets, but it’s much more robust (http://zguide.zeromq.org/py:all) There’s a library that uses zeroMQ to provide a RPC framework that works pretty well. It’s called zeroRPC (http://www.zerorpc.io/). Here’s the hello world. Python “Hello … Read more