From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93713 invoked by alias); 8 Feb 2020 00:12:48 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 93705 invoked by uid 89); 8 Feb 2020 00:12:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL,BAYES_50,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.1 spammy=problemshtml, problems.html, UD:problems.html, docshtml X-HELO: mail-vs1-f44.google.com Received: from mail-vs1-f44.google.com (HELO mail-vs1-f44.google.com) (209.85.217.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 08 Feb 2020 00:12:44 +0000 Received: by mail-vs1-f44.google.com with SMTP id p14so760480vsq.6 for ; Fri, 07 Feb 2020 16:12:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=zzeEXsU/x6w/ZMdXr9FSkXa8kg2iu9pTrHcZ6QqZ3wI=; b=VIsLWnpIoCw7gNP7YjgAGRPY9wcHnxVmKVtusSH5niTxturt+xpepT19xO45kln0ES dVHy5w16pT1XCgoz27FOkgU6wP9TScIRJMskoc83sLfdsK6BxtHWePcgAA5rVWg+AjBA fcsEIaVlnHKMcL8ioix84ShySHNFONZjmfVmC4ipRYC/ciNVvbJVadeqOb0RCWYp8wPQ I1/Cznhbgos5xoeuhjETP2jkucGCSBAsbFI/F4tyjij3SZX4NxJg7YwI2LbIEdqhoNGJ WXBBTmIG5mYw7z9dsLwedDRUKzQ9gmGlgvLaOVq1cC69s4cRpX8c78ZCHq5mrDdhm/Vr b3uA== MIME-Version: 1.0 References: <5a745b381650978f29cb650757ffa3c4acc62f49.camel@Askesis.nl> In-Reply-To: <5a745b381650978f29cb650757ffa3c4acc62f49.camel@Askesis.nl> From: Olivia Nelson Date: Sat, 08 Feb 2020 00:12:00 -0000 Message-ID: Subject: Re: DllMain not called in CreateRemoteThread To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00058.txt.bz2 Sorry, I made a mistake. I've updated the title .. To summarize: 1. I can load the DLL compiled with cygwin with LoadLibraryA, but not remotely with CreateRemoteThread. 2. The same DLL compiled with msvc works with both LoadLibraryA and CreateRemoteThread Answer to Joost: constructor and destructor are called with LoadLibraryA, but not with CreateRemoteThread either Answer to Marco 1. I can't use mingw, it does not provide sys/XXX.h, e,g socket 2. I copied cygwin1.dll to system32, and it works outside cygwin environment Here's a implementation of the DLL injector in C#: https://codingvision.net/miscellaneous/c-inject-a-dll-into-a-process-w-createremotethread On Sat, Feb 8, 2020 at 3:10 AM Joost Kraaijeveld wrote: > > Does > > static void __attribute__((constructor)) > static void __attribute__((destructor)) > > work? > > > See e.g. > https://stackoverflow.com/questions/2053029/how-exactly-does-attribute-constructor-work > > > > > -- > Problem reports: http://cygwin.com/problems.html > FAQ: http://cygwin.com/faq/ > Documentation: http://cygwin.com/docs.html > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple