Jump to content

Mike Torrettinni

Members
  • Content Count

    1509
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Mike Torrettinni


  1. Just now, David Schwartz said:

    As I said, I back-up anything I can't get from somewhere else or recreate quickly.

     

    But you're making an assumption here, which is exactly why I said most people forget about this. (Hint: what were YOU referring to regarding saving/backups? And what do you think I was referring to?)

    I've never done any restore that involve registry settings, except running registry patches like regarding disabling some Delphi packages that slow down IDE. So, I was just trying to understand what you are referring to, perhaps something it's useful for me too, but never realized that's a good idea to have backup of.


  2. 3 hours ago, Darian Miller said:

    Keep in mind the 3-2-1 (or 3-2-3) backup strategy.

    It says: "Note that you need to ask your backup vendor specifically whether they offer a 3-1-2 as shown or if they offer only a 3-1-1 (one copy in the cloud.)  Don’t accept only a single copy in the cloud – it simply doesn’t offer the protection afforded by modern continuity and backup solutions."

     

    Is anybody really doing this? Requiring their backup vendor to have 3-1-1/3-1-2 backup of their data?

    So, if I have have 3 backup copies of my source, and vendor has 3 backup copies of what I upload to cloud backup... there are 6 backup copies of my source! And if that backup vendor is using a 3rd party backup vendor for one of the copies... 🙂 🙂 🙂


  3. 4 hours ago, Dalija Prasnikar said:

     

    3 hours ago, Lars Fosdal said:

    There are workarounds for large files and binaries.

    https://www.perforce.com/blog/vcs/how-git-lfs-works

     

    Thanks, interesting. Definitely something to think about, but for sure need to clean up any large files, like zip, pdf, psd... also found a few 150MB .rsm files.


  4. 4 hours ago, Pawel Piotrowski said:

    If you are worrying about the repository size on the server, remember that SVN stores delta files even for binary files. Maybe not as gracefully as for real text files, but disk space is much cheaper then developer time.

    I assume same for Git, right? So I can put a lot of non-source stuff (icons, docs, scripts...) into single repository  and it will push only deltas to github.


  5. I just had a little issue with a website backup and hard time rolling back some changes, so decided to put it under the source control.

    I wish I had done this sooner, so I'm thinking what else makes sense to put under source control, like: documentation, various scripts.

     

    Do you also put 3rd party source code under source control? I rarely change anything, but I do have some patches I apply to some components on new install.

     

    What do you guys have under source control?


  6. 2 minutes ago, Dany Marmur said:

    So before i start to wrap my head around the alternatives, i cannot know if it will be the time-save that i need.

    That's why I gave up on .rc file, after 2h I couldn't make it work on new empty project, so I can't imagine it's worth investing time for all my projects, because I'm sure each of them will have it's own little quirk and valid reason why it's not working.

     

    Setting version in .dproj file on build and commit worked out of the box and every time, since.


  7. 1 minute ago, Dany Marmur said:

    @Mike Torrettinni, k, so there's a real use-case. Cool.

    Integration with Photoshop (a multiplatform suite that actually has it's own platform on top, or below, that) should be done using the abilities and preferred integration strategy that Adobe suggest/documents/implement for that (Photoshop). IMHO you will run in to "thingies" for eternality. Once again, my meta-KISS-head is rearing.

    Photoshop was just an example of impossibility for me to ask/force all these big companies to customize their tools to fit the needs of my tool. Just because they don't make it easy, doesn't mean it's not possible.

    Like I said, the user manual setup works just fine, the value of the tool is well worth even if the manual change is needed a few times a day - but it's annoying and now I'm investigating this option.


  8. OK, let me try with example, lets look at Photoshop. Imagine it can be setup so each currently opened file you work on has it's own temp/permanent folder that contains scratch files, history, backup files... basically anything related to your .psd file.

    And you have a plugin/external tool that extends Photoshop features, based on all those files (perhaps you can look at the history, and pick and choose from it; perhaps there are files that contain brushes... anything that Photoshop doesn't make available on it's own).

     

    And Photoshop has an option to send a current working filename to your external tool and it only sends filename, but not the current working folder that has all the other files. The information about that folder is available for users to setup in Photoshop, so they know exactly where it is, but your tool doesn't. So, you can't really go to Adobe and ask them to modify their script to pass all the info you need, to make it easier for your tool.

     

    And the way Photoshop 'calls' your external tool is with a cmd from the current working folder of the current opened file. And this is the info your tool needs to work with to be useful.

     

    18 minutes ago, Dany Marmur said:

    Wow! This was a long one, and i do not feel i have the time to sift

    Yes, it took me a while to realize that Parent process is not persistent and even if it was, it's not easy to get it's current working dir, because the OS doesn't have this info just readily available.


  9. 1 hour ago, Fr0sT.Brutal said:

    You mean, launching bat file instead of your project? How it could help? There's no principal difference between running cmd.exe and yourproject.exe

    Perhaps I don't know that it's possible, but can you identify what was the current directory that your project was called from? Please share the code.


  10. 2 hours ago, Fr0sT.Brutal said:

    Don't CurrDir of your project that is by default inherited from launching process and path to launching process' image file satisfy your needs?

    Btw, CurrDir is unreliable anyway. F.ex.:
     

    
    >cmd
    
    c:\users\user> d:\soft\that-tool-calling-my-project\tool.exe

      

    Exactly, not reliable. I need to know where the the line was executed because this is current directory of the process that executes my project. And if Parent would always be persistent process, this would be Parent's current directory.

    So, I was hoping for function GetProcessCurrentDirectoty(ParentPID): string; 😉

     

    Now, I will have to use batch file to get the current directory and pass it to my project.

     

     


  11. 10 hours ago, Remy Lebeau said:

    Thanks, I did see similar scripts, some in Delphi already. Like Raymond says "Once the process can access its own command line, the kernel’s responsibilities are done. ", I guess is not completely true, since the command line is displayed in Task Manager.

    Same for Parent process current directory, not easily accessible.

     

    But if Parent process is not running anymore, then there is no info to get anyway.


  12. OK, let me try to explain: I have a project that is run by different tools and it has limited info that it can receive (well, limited info/parameters are available from the calling tools - the tools I don't control), and those tools don't send their starting directory, although I need it in 100% cases. So, my project needs to have manually adjusted a setting that tells what the what the calling tool is and the starting point/directory. And based on that info my project behaves as it should. And users need to set this manually. In many cases they set it once and forget about it. But there are cases where they need to 'switch' between multiple start locations, multiple times a day - annoying, but necessary.

     

    So I have 2 options to improve this, to some extent: there is limited option where I can have a batch to run between the tool and before my project gets called (so the tool actually run my the batch file), which in theory could be used to get the start directory and pass it to my project. But this is not 100% in all cases, well this is also still being researched and in testing mode, because not all tools call my project in the same way.

     

    But when I was looking at how these tools behave with Process monitor, I saw that the Current directory info was available for every instance of a Parent process. Testing with a few most commonly used tools, the Parent task was always opened, while running my project. And I was hoping I can get the same info within my project. And here we are now, knowing that I can't rely on a fact that the parent process will always be opened, for my project to query it's info.

     

    So, now back to trying to make it work with batch file in between and see what 'limited or unlimited' options I have there.

     

    I thought it would be pointless to put all this into the original post.

     


  13. So, long story short, David was right, I did find a tool that closes it's process right after it calls my project. So, if I want to have broad solution, I have to take this into account.

    Even though this tool is rarely used, I can't rely on the fact other tools that keep the process open, will not change their implementation in the future.

     

    OK, research done. This is not the way to do it: can't rely on Current directory of the Parent process.


  14. 22 minutes ago, Kas Ob. said:

    using DLL injection,

    Thanks, I think I don't want to go near this. I have no idea how this affects the running process, if anti-malware could catch the action and alert users... I don't even want to think how to defend the action, this definitely feels like going rogue on my customers 🙂


  15. 3 minutes ago, David Heffernan said:

    Then you are in trouble because there's really no way in general to be sure that the process which created your process still exists when your process executes. Windows has a very different model of parent/child process relationships from say Linux.

     

    What problem are you trying to solve? 

    Right now I have a workaround, a solution that works, but it requires manual work by users and in some cases (big customers) they need to do this manual work multiple times a day - they know the 'current directory'.

     

    I'm trying to avoid this and automate without their interaction. One way is to have that interceptor/bridge batch that can pass the parameter, or perhaps I can find by looking at Parent's info. Like I said, the process stays opened, until my process is done.


  16. 1 minute ago, David Heffernan said:

    The command interpreter process, which is the parent, might terminate before your process has a chance to inspect it.

    It could be that will be the case in some situations, but currently the process waits until my project closes. And if it does, I believe the solution is to see if the process with same PID has been created after my process (so the original parent exited and same PID might be assigned to new process).

     

    2 minutes ago, David Heffernan said:

    If you are in charge of creating the process, then pass in the information required as an argument. 

    Yes, in a way I am/can be in charge, but I'm trying to figure out a way to do this without this, so it's more general solution.

     

    Last night I noticed that Process monitor can get the Current directory, so overnight I tried to find a way to do it on my own. So, as hours progressed I have more info, and now I see that this could be a tricky thing.

    But I'm not done looking into it, yet.

     

     


  17. 5 minutes ago, Lars Fosdal said:

    If the parent process runs at a higher security level than your own, you will have a hard time gleaning info from the process without elevating your own process.

    Ok, makes sense. I'm not against the need for my project to run as admin, if necessary.

     

    But as I tested a script that might give the correct info, it fails to use ReadProcessMemory (after NtQueryInformationProcess(handle, ProcessBasicInformation...) ) on the selected parent process, with or without Delphi running as Admin.

    For some other processes I can see PWD=c:\... info, which I think is what I'm looking for (but not 100%), just not for the processes I need.

     

    Seems like I'm close, but I've never done anything like reading other processes memory, so it's a little of guesswork. I thought someone already has done something like this, in Delphi, of course.

×