diff --git a/BBWY.Client/GlobalContext.cs b/BBWY.Client/GlobalContext.cs index 3a5b9caa..f76fcbaf 100644 --- a/BBWY.Client/GlobalContext.cs +++ b/BBWY.Client/GlobalContext.cs @@ -5,6 +5,13 @@ namespace BBWY.Client { public class GlobalContext : NotifyObject { + public GlobalContext() + { + DongDongServiceNameList = new List(); + + + } + private User user; public User User { get => user; set { Set(ref user, value); } } @@ -13,6 +20,8 @@ namespace BBWY.Client public IList LogisticsResponseList { get; set; } + public IList DongDongServiceNameList { get; set; } + /// /// JD客户端 /// diff --git a/BBWY.Client/ViewModels/MainViewModel.cs b/BBWY.Client/ViewModels/MainViewModel.cs index 01b4814d..d111fdc3 100644 --- a/BBWY.Client/ViewModels/MainViewModel.cs +++ b/BBWY.Client/ViewModels/MainViewModel.cs @@ -345,6 +345,8 @@ namespace BBWY.Client.ViewModels GlobalContext.User.Shop = shop; //ShowShopChoosePanel = false; Task.Factory.StartNew(GetLogisticsList); + if (shop.Platform == Platform.京东) + Task.Factory.StartNew(GetJDServiceGroup); } private void GetLogisticsList() @@ -404,6 +406,11 @@ namespace BBWY.Client.ViewModels { Wb2DownloadProgress = e.ProgressPercentage; } + + private void GetJDServiceGroup() + { + + } #endregion } } diff --git a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs index 8052c0a0..dbd8cfc3 100644 --- a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs +++ b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs @@ -118,6 +118,8 @@ namespace BBWY.Client.ViewModels public ICommand DecodeConsigneeCommand { get; set; } + public ICommand GetBuyerAccountCommand { get; set; } + public ICommand ChooseStorageTypeCommand { get; set; } public ICommand EditCostCommand { get; set; } @@ -218,7 +220,8 @@ namespace BBWY.Client.ViewModels { Task.Factory.StartNew(() => LoadOrder(p.PageIndex)); }); - DecodeConsigneeCommand = new RelayCommand(DecodeConsignee); + //DecodeConsigneeCommand = new RelayCommand(DecodeConsignee); + GetBuyerAccountCommand = new RelayCommand(GetBuyerAccount); ChooseStorageTypeCommand = new RelayCommand(ChooseStorageType); EditCostCommand = new RelayCommand(EditCost); OutStockCommand = new RelayCommand((o) => OutStock(o)); @@ -528,7 +531,7 @@ namespace BBWY.Client.ViewModels // }); //} - private void DecodeConsignee(Order order) + private void GetBuyerAccount(Order order) { var buyerAccount = string.Empty; var grab = new GrabJDMibole(order.Id); @@ -536,9 +539,13 @@ namespace BBWY.Client.ViewModels buyerAccount = grab.Tag.ToString(); if (string.IsNullOrEmpty(buyerAccount)) { - MessageBox.Show("未获取到手机号", "提示"); + MessageBox.Show("未获取到买家账号", "提示"); return; } + order.BuyerAccount = buyerAccount; + + //唤醒咚咚 + } private void ChooseStorageType(object param) diff --git a/BBWY.Client/ViewModels/Order/OrderListVoewModel_DongDong.cs b/BBWY.Client/ViewModels/Order/OrderListVoewModel_DongDong.cs index c607871b..9afc6f99 100644 --- a/BBWY.Client/ViewModels/Order/OrderListVoewModel_DongDong.cs +++ b/BBWY.Client/ViewModels/Order/OrderListVoewModel_DongDong.cs @@ -1,21 +1,65 @@ using BBWY.Client.Helpers; +using Newtonsoft.Json.Linq; using System; +using System.Collections.Concurrent; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; namespace BBWY.Client.ViewModels { public partial class OrderListViewModel { private PipeHelper pipeHelper; + private ConcurrentDictionary dongdongBuyerDictionary; public void InitDongDong() { + dongdongBuyerDictionary = new ConcurrentDictionary(); pipeHelper.ServerReceiveCallback = OnDongDongSendMessage; pipeHelper.CreateServer("bbwyPipeServer"); } private void OnDongDongSendMessage(string msg) { - Console.WriteLine(msg); + if (string.IsNullOrEmpty(msg)) + return; + try + { + var j = JObject.Parse(msg); + var buyerAccount = j.Value("user"); + var phone = j.Value("phone"); + if (!string.IsNullOrEmpty(buyerAccount) && !string.IsNullOrEmpty(phone)) + { + var key = $"{buyerAccount}_{phone}"; + if (!dongdongBuyerDictionary.TryAdd(key, phone)) + return; + } + + var order = OrderList.FirstOrDefault(o => !string.IsNullOrEmpty(o.BuyerAccount) && o.BuyerAccount == buyerAccount); + if (order != null && order.Consignee != null && order.Consignee.IsDecode) + return; //已经解密过 + + Task.Factory.StartNew(() => orderService.DecodeConsignee(order.Id, phone)).ContinueWith(t => + { + var response = t.Result; + IsLoading = false; + if (!response.Success) + { + App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "解密失败")); + return; + } + order.Consignee.ContactName = response.Data.ContactName; + order.Consignee.Address = response.Data.Address; + order.Consignee.Mobile = response.Data.Mobile; + order.Consignee.IsDecode = true; + }); + + } + catch (Exception ex) + { + + } } } } diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs index 04a69a02..dcfdaf2e 100644 --- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs @@ -824,7 +824,6 @@ namespace BBWY.Server.Business #endregion - #region 获取主商品品牌 { stepText = "获取主商品品牌"; diff --git a/BBWY.Test/JDDongDongAPITest.cs b/BBWY.Test/JDDongDongAPITest.cs new file mode 100644 index 00000000..078d8e59 --- /dev/null +++ b/BBWY.Test/JDDongDongAPITest.cs @@ -0,0 +1,19 @@ +using Jd.Api; +using Jd.Api.Request; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Test +{ + public class JDDongDongAPITest + { + public void GetServiceGroup(IJdClient client, string token) + { + var req = new ImPopGroupinfoGetRequest(); + var response = client.Execute(req, token, DateTime.Now.ToLocalTime()); + Console.WriteLine(JsonConvert.SerializeObject(response)); + } + } +} diff --git a/BBWY.Test/JDPromotionAPITest.cs b/BBWY.Test/JDPromotionAPITest.cs new file mode 100644 index 00000000..44263274 --- /dev/null +++ b/BBWY.Test/JDPromotionAPITest.cs @@ -0,0 +1,54 @@ +using Jd.Api; +using Jd.Api.Request; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Linq; + +namespace BBWY.Test +{ + public class JDPromotionAPITest + { + public void GetPromotionDetailById(IJdClient client, string token, long promotionId) + { + { + + var req = new SellerPromotionV2GetRequest(); + req.promoId = promotionId; + req.promoType = 4; + var response = client.Execute(req, token, DateTime.Now.ToLocalTime()); + Console.WriteLine(JsonConvert.SerializeObject(response)); + + Console.WriteLine(); + } + { + var pageIndex = 1; + while (true) + { + var req = new SellerPromotionV2SkuListRequest(); + req.promoId = promotionId; + //req.bindType = ; + + req.promoType = 4; + + req.page = pageIndex.ToString(); + + req.pageSSize = "100"; + var response = client.Execute(req, token, DateTime.Now.ToLocalTime()); + Console.WriteLine(JsonConvert.SerializeObject(response)); + if (response.IsError) + continue; + if (response.Json == null) + response.Json = JObject.Parse(response.Body); + var jarray = response.Json["jingdong_seller_promotion_v2_sku_list_responce"]["promotion_sku_list"] as JArray; + if (jarray.Count() >= 100) + pageIndex++; + else + break; + } + + } + + } + } +} diff --git a/BBWY.Test/Program.cs b/BBWY.Test/Program.cs index a6a92a69..a1345220 100644 --- a/BBWY.Test/Program.cs +++ b/BBWY.Test/Program.cs @@ -18,15 +18,15 @@ namespace BBWY.Test static void Main(string[] args) { - var appkey = "E1AA9247D5583A6D87449CE6AB290185"; - var appSecret = "e479558ddd9e40f8929cfc00c6cbbc9c"; + //var appkey = "E1AA9247D5583A6D87449CE6AB290185"; + //var appSecret = "e479558ddd9e40f8929cfc00c6cbbc9c"; ////0e61c4a8ec3e4df4b5836e10884db9220yth 齐盛 ////2ace3023200c4ea9aa682bbf8bffee18jztm 布莱特玩具 - var token = "01dc6f6e7fc34dcd99090d690312556cmdfk"; //齐盛 + //var token = "01dc6f6e7fc34dcd99090d690312556cmdfk"; //齐盛 - //var appkey = "120EA9EC65AB017567D78CC1139EEEA5"; - //var appSecret = "8a42bc2301e8439b896e99f5475e0a9b"; - //var token = "2ace3023200c4ea9aa682bbf8bffee18jztm"; + var appkey = "120EA9EC65AB017567D78CC1139EEEA5"; + var appSecret = "8a42bc2301e8439b896e99f5475e0a9b"; + var token = "2ace3023200c4ea9aa682bbf8bffee18jztm"; //var path = @"C:\Users\pengcong001\Desktop\含赠品SKU.txt"; //var j = JToken.Parse(System.IO.File.ReadAllText(path, System.Text.Encoding.UTF8)); @@ -39,44 +39,8 @@ namespace BBWY.Test IJdClient client = GetJdClient(appkey, appSecret); - { - - var req = new SellerPromotionV2GetRequest(); - req.promoId = 30777427018; - req.promoType = 4; - var response = client.Execute(req, token, DateTime.Now.ToLocalTime()); - Console.WriteLine(JsonConvert.SerializeObject(response)); - - Console.WriteLine(); - } - { - var pageIndex = 1; - while (true) - { - var req = new SellerPromotionV2SkuListRequest(); - req.promoId = 30777427018; - //req.bindType = ; - - req.promoType = 4; - - req.page = pageIndex.ToString(); - - req.pageSSize = "100"; - var response = client.Execute(req, token, DateTime.Now.ToLocalTime()); - Console.WriteLine(JsonConvert.SerializeObject(response)); - if (response.IsError) - continue; - if (response.Json == null) - response.Json = JObject.Parse(response.Body); - var jarray = response.Json["jingdong_seller_promotion_v2_sku_list_responce"]["promotion_sku_list"] as JArray; - if (jarray.Count() >= 100) - pageIndex++; - else - break; - } - - } - + var p = new JDDongDongAPITest(); + p.GetServiceGroup(client, token); //var p = new JDProductAPITest(); //p.GetSkus(client, token); diff --git a/BBWY.sln b/BBWY.sln index e2c8cc78..2a707e0a 100644 --- a/BBWY.sln +++ b/BBWY.sln @@ -38,7 +38,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JD.API", "JD.API\JD.API.csp EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PJZS", "PJZS\PJZS.csproj", "{FB4BF1A9-DA81-446F-903C-89D3F905B7B8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InDll", "DongDongInJection\InDll\InDll.csproj", "{1F19E500-3B6A-40F9-9814-C941097B93D9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InDll2", "InDll2\InDll2.csproj", "{1FD36D27-9BED-4E72-B81C-CBC0C4A3120E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -144,14 +144,14 @@ Global {FB4BF1A9-DA81-446F-903C-89D3F905B7B8}.Release|Any CPU.Build.0 = Release|Any CPU {FB4BF1A9-DA81-446F-903C-89D3F905B7B8}.Release|x86.ActiveCfg = Release|Any CPU {FB4BF1A9-DA81-446F-903C-89D3F905B7B8}.Release|x86.Build.0 = Release|Any CPU - {1F19E500-3B6A-40F9-9814-C941097B93D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1F19E500-3B6A-40F9-9814-C941097B93D9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1F19E500-3B6A-40F9-9814-C941097B93D9}.Debug|x86.ActiveCfg = Debug|x86 - {1F19E500-3B6A-40F9-9814-C941097B93D9}.Debug|x86.Build.0 = Debug|x86 - {1F19E500-3B6A-40F9-9814-C941097B93D9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1F19E500-3B6A-40F9-9814-C941097B93D9}.Release|Any CPU.Build.0 = Release|Any CPU - {1F19E500-3B6A-40F9-9814-C941097B93D9}.Release|x86.ActiveCfg = Release|x86 - {1F19E500-3B6A-40F9-9814-C941097B93D9}.Release|x86.Build.0 = Release|x86 + {1FD36D27-9BED-4E72-B81C-CBC0C4A3120E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1FD36D27-9BED-4E72-B81C-CBC0C4A3120E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1FD36D27-9BED-4E72-B81C-CBC0C4A3120E}.Debug|x86.ActiveCfg = Debug|Any CPU + {1FD36D27-9BED-4E72-B81C-CBC0C4A3120E}.Debug|x86.Build.0 = Debug|Any CPU + {1FD36D27-9BED-4E72-B81C-CBC0C4A3120E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1FD36D27-9BED-4E72-B81C-CBC0C4A3120E}.Release|Any CPU.Build.0 = Release|Any CPU + {1FD36D27-9BED-4E72-B81C-CBC0C4A3120E}.Release|x86.ActiveCfg = Release|Any CPU + {1FD36D27-9BED-4E72-B81C-CBC0C4A3120E}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -168,7 +168,7 @@ Global {FCD5E03E-DA48-406B-9AA8-F72F21F62BDB} = {B545F3FA-E6A7-4CB1-B92D-801C66357CF5} {3D37A8D3-0364-4539-B3E9-A6610F4659A8} = {B545F3FA-E6A7-4CB1-B92D-801C66357CF5} {FB4BF1A9-DA81-446F-903C-89D3F905B7B8} = {D097AEA5-A7B1-414D-B82D-F70F177D0D8D} - {1F19E500-3B6A-40F9-9814-C941097B93D9} = {D097AEA5-A7B1-414D-B82D-F70F177D0D8D} + {1FD36D27-9BED-4E72-B81C-CBC0C4A3120E} = {D097AEA5-A7B1-414D-B82D-F70F177D0D8D} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {CC045257-4D86-45FD-A1F0-2715C024F1B5} diff --git a/InDll2/CSharpAPIs.cs b/InDll2/CSharpAPIs.cs new file mode 100644 index 00000000..9925fdb7 --- /dev/null +++ b/InDll2/CSharpAPIs.cs @@ -0,0 +1,241 @@ + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace QYDongDongTool +{ + public class CSharpAPIs + { + private delegate bool WNDENUMPROC(IntPtr hWnd, int lParam); + [DllImport("user32.dll")] + private static extern bool EnumWindows(WNDENUMPROC lpEnumFunc, int lParam); + //[DllImport("user32.dll")] + //private static extern IntPtr FindWindowW(string lpClassName, string lpWindowName); + [DllImport("user32.dll")] + private static extern int GetWindowTextW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpString, int nMaxCount); + [DllImport("user32.dll")] + private static extern int GetClassNameW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpString, int nMaxCount); + + + [DllImport("User32.dll", CharSet = CharSet.Auto)] + public static extern int GetWindowThreadProcessId(IntPtr hwnd, out int ID); + + + [DllImport("user32.dll", EntryPoint = "ShowWindow", SetLastError = true)] + public static extern int ShowWindow(IntPtr hwnd, int nCmdShow); + + [DllImport("user32.dll")] + public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndlnsertAfter, int X, int Y, int cx, int cy, uint Flags); + + [DllImport("user32.dll", EntryPoint = "SetParent")] + public static extern int SetParent(IntPtr hWndChild, IntPtr hWndNewParent); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + public static extern int MoveWindow(IntPtr hWnd, int x, int y, int nWidth, int nHeight, bool BRePaint); + + + [DllImport("user32.dll")] + public static extern IntPtr GetTopWindow(IntPtr hWnd); + + [DllImport("user32.dll", CharSet = CharSet.Auto, EntryPoint = "GetWindow", SetLastError = true)] + public static extern IntPtr GetNextWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.U4)] int wFlag); + + [DllImport("user32.dll", EntryPoint = "GetDesktopWindow", CharSet = CharSet.Auto, SetLastError = true)] + public static extern IntPtr GetDesktopWindow(); + + [DllImport("user32.dll", EntryPoint = "GetWindowLong")] + private static extern IntPtr GetWindowLongPtr32(IntPtr hWnd, int nIndex); + + [DllImport("user32.dll", EntryPoint = "GetWindowLongPtr")] + private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, int nIndex); + + // This static method is required because Win32 does not support + // GetWindowLongPtr directly + public static IntPtr GetWindowLong(IntPtr hWnd, int nIndex) + { + if (IntPtr.Size == 8) + return GetWindowLongPtr64(hWnd, nIndex); + else + return GetWindowLongPtr32(hWnd, nIndex); + } + + + public static IntPtr SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong) + { + if (IntPtr.Size == 8) + return SetWindowLongPtr64(hWnd, nIndex, dwNewLong); + else + return new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32())); + } + + [DllImport("user32.dll", EntryPoint = "SetWindowLong")] + private static extern int SetWindowLong32(IntPtr hWnd, int nIndex, int dwNewLong); + + [DllImport("user32.dll", EntryPoint = "SetWindowLongPtr")] + private static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, int nIndex, IntPtr dwNewLong); + + [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] + public static extern IntPtr GetForegroundWindow(); + + [DllImport("user32.dll")] + public static extern bool SetForegroundWindow(IntPtr hWnd); + + + //根据窗口来获取进程ID, + public static int GetCurrentProcessID(IntPtr handle) + { + GetWindowThreadProcessId(handle, out int oo); + return oo; + } + public struct WindowInfo + { + public IntPtr hWnd; + public string szWindowName; + public string szClassName; + public int ProcessId { get; set; } + + public int Width { get; set; } + + public int Height { get; set; } + + public int X { get; set; } + + public int Y { get; set; } + } + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect); + + [StructLayout(LayoutKind.Sequential)] + public struct RECT + { + public int Left; //最左坐标 + public int Top; //最上坐标 + public int Right; //最右坐标 + public int Bottom; //最下坐标 + } + + + public static (int width, int height, int x, int y) GetWindowSize(IntPtr hwnd) + { + RECT rc = new RECT(); + GetWindowRect(hwnd, ref rc); + + int width = rc.Right - rc.Left; //窗口的宽度 + int height = rc.Bottom - rc.Top; //窗口的高度 + int x = rc.Left; + int y = rc.Top; + + + return (width, height, x, y); + } + + + + + /* + SetWindowLong(ChildWindowHandle, GWL_EXSTYLE, (GetWindowLong(ChildWindowHandle, GWL_EXSTYLE) | WS_EX_NOPARENTNOTIFY)); + */ + public enum GWL + { + GWL_WNDPROC = (-4), + GWL_HINSTANCE = (-6), + GWL_HWNDPARENT = (-8), + GWL_STYLE = (-16), + GWL_EXSTYLE = (-20), + GWL_USERDATA = (-21), + GWL_ID = (-12) + } + + + public static bool ReSetParent(IntPtr hWnd) + { + int row= SetParent(hWnd, GetDesktopWindow()); + MoveWindow(hWnd, 0, 0, 0, 0, true); + return row > 0; + } + + + public static WindowInfo GetWindowInfo(IntPtr hWnd) + { + WindowInfo wnd = new WindowInfo(); + StringBuilder sb = new StringBuilder(256); + //get hwnd + wnd.hWnd = hWnd; + //get window name + GetWindowTextW(hWnd, sb, sb.Capacity); + wnd.szWindowName = sb.ToString(); + //get window class + GetClassNameW(hWnd, sb, sb.Capacity); + wnd.szClassName = sb.ToString(); + wnd.ProcessId = GetCurrentProcessID(hWnd); + + var size= GetWindowSize(hWnd); + wnd.Width = size.width; + wnd.Height = size.height; + wnd.X = size.x; + wnd.Y = size.y; + + return wnd; + } + + + + public List GetAllDesktopWindows() + { + List wndList = new List(); + + //enum all desktop windows + EnumWindows(delegate (IntPtr hWnd, int lParam) + { + WindowInfo wnd = new WindowInfo(); + StringBuilder sb = new StringBuilder(256); + //get hwnd + wnd.hWnd = hWnd; + //get window name + GetWindowTextW(hWnd, sb, sb.Capacity); + wnd.szWindowName = sb.ToString(); + //get window class + GetClassNameW(hWnd, sb, sb.Capacity); + wnd.szClassName = sb.ToString(); + wnd.ProcessId = GetCurrentProcessID(hWnd); + + var (width, height, x, y) = GetWindowSize(hWnd); + wnd.Width = width; + wnd.Height = height; + wnd.X = x; + wnd.Y = y; + + //add it into list + wndList.Add(wnd); + return true; + }, 0); + + return wndList; + } + //获取窗体位置 最小化 最大化 隐藏 api + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl); + + + + } + +} + +public struct WINDOWPLACEMENT +{ + public int length; + public int flags; + public int showCmd; + public System.Drawing.Point ptMinPosition; + public System.Drawing.Point ptMaxPosition; + public System.Drawing.Rectangle rcNormalPosition; +} diff --git a/InDll2/DllInLine.dll b/InDll2/DllInLine.dll new file mode 100644 index 00000000..9dd46323 Binary files /dev/null and b/InDll2/DllInLine.dll differ diff --git a/InDll2/HookHelper.cs b/InDll2/HookHelper.cs new file mode 100644 index 00000000..2334c87d --- /dev/null +++ b/InDll2/HookHelper.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Xml.Linq; + +namespace QYDongDongTool.Unitls +{ + public class MP + { + [DllImport("DllInLine.dll", EntryPoint = "Hook", CallingConvention = CallingConvention.Cdecl)] + public static extern int DllHook(int pid, string dLLPath); + + + [DllImport("DllInLine.dll", EntryPoint = "UnHook", CallingConvention = CallingConvention.Cdecl)] + public static extern int UnHookDll(int pid); + + + public static bool Hook(int pid) + { + string sDllPath = System.Environment.CurrentDirectory+ "\\sendPhone.dll"; + return DllHook(pid, sDllPath) ==0; + } + + public static bool UnHook(int pid) + { + int val= UnHookDll(pid); + return val==0; + } + } +} diff --git a/InDll2/InDll2.csproj b/InDll2/InDll2.csproj new file mode 100644 index 00000000..9afd8675 --- /dev/null +++ b/InDll2/InDll2.csproj @@ -0,0 +1,17 @@ + + + + Exe + netcoreapp3.1 + + + + + Always + + + Always + + + + diff --git a/InDll2/Program.cs b/InDll2/Program.cs new file mode 100644 index 00000000..7e6874ed --- /dev/null +++ b/InDll2/Program.cs @@ -0,0 +1,61 @@ +// See https://aka.ms/new-console-template for more information +using QYDongDongTool; +using QYDongDongTool.Unitls; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; + +public class Program +{ + + public static void Main() + { + + var list = GetAllDongdongUser(); + + Console.WriteLine(string.Join(",",list)); + + //var list = new CSharpAPIs().GetAllDesktopWindows(); + + //var windows = list.Where(c => c.szClassName == "DD_JM_Workbench_DLG").ToList(); + + //windows.ForEach(info => + //{ + + // foreach (ProcessModule module in Process.GetProcessById(info.ProcessId).Modules) + // { + // //检测是否已经注入 + // if (module.ModuleName.Contains("sendPhone.dll")) + // { + // return; + // } + // } + + // //注入dll + // MP.Hook((int)info.ProcessId); + + //}); + } + + + /// + /// 获取全部登录咚咚账号 + /// + /// + public static List GetAllDongdongUser() + { + + List dongdongList = new List(); + var list = new CSharpAPIs().GetAllDesktopWindows(); + + var windows = list.Where(c => c.szClassName == "DD_JM_Workbench_DLG").ToList(); + + windows.ForEach(info => + { + dongdongList.Add(info.szWindowName.Replace("的工作台", "")); + }); + + return dongdongList; + } +} \ No newline at end of file diff --git a/InDll2/sendPhone.dll b/InDll2/sendPhone.dll new file mode 100644 index 00000000..8eadd0bb Binary files /dev/null and b/InDll2/sendPhone.dll differ diff --git a/dll注入器.rar b/dll注入器.rar deleted file mode 100644 index bd2d4dd7..00000000 Binary files a/dll注入器.rar and /dev/null differ