GithubHelp home page GithubHelp logo

alexanderomara / flshm Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 120 KB

Flash Player LocalConnection Shared Memory Native Code Library

License: Mozilla Public License 2.0

Makefile 14.76% C 44.63% ActionScript 26.79% Python 1.62% CMake 1.73% AngelScript 10.48%
c flash-player amf semaphore shared-memory library flash adobe-flash adobe-flash-player

flshm's Introduction

flshm

Flash Player LocalConnection Shared Memory Native Code Library

travis-ci appveyor

Overview

This library is a native code library for connecting to the LocalConnection API used by Flash Player. This is done by connecting to the same shared memory and semaphores, to read and write to the messaging system. All of this was made possible by reverse engineering the API's and messaging formats used by Flash Player.

Compatibility

The library was tested against Flash Player 6 and up (Flash Player 6 introduced LocalConnection), and Flash Player on Windows, Mac, and Linux are all supported.

This library is tested against the compilers Clang, GCC, MSVC, and MinGW. See Travis and AppVeyor CI configuration for exact versions that are tested against. The library will likely also work with other compatible C99 compilers.

Usage

See the util directory for some sample usage. Some things to keep in mind.

  • Message and connection properties vary by different versions, refer to header comments for details.
  • Message data is a series of AMF encoded data, AMF0 or AMF3 depending on the message (size defines how large the encoded data is).
  • Full AMF encoders and decoders are not included, the library only handles the subset of AMF0 necessary to parse the message headers.
  • AMF0 arguments are encoded in reverse order, however AMF3 arguments are not.
  • Some data types like an AMF0 string are trivial to encode and decode, and this library includes a few AMF0 encoders and decoders, but if full AMF0 or AMF3 support is required, consider some existing AMF libraries.
  • There is a maximum of 8 connections imposed by Flash Player.
  • Connection names must be in one of the following formats, else it is invalid.
    • hostname:connection-name (example.com:name, localhost:name)
    • _global-connection-name (_domainshared:name)
  • Connection names do not include the lowest subdomain.
    • example.com = example.com
    • www.example.com = example.com
    • a.b.example.com = b.example.com).
  • Set is_per_user to match the isPerUser property used in ActionScript (the default is and will likely stay false, and this property is not available in older versions of Flash Player itself).
  • Sandboxing is not implemented in the library itself, so validate the message before handling it.
  • Clear a message when received, and intended for the connection, else it will timeout and the connection will be removed from the registered list.
  • Use the flshm_lock and flshm_unlock functions to lock the semaphore for exclusive access to the shared memory while reading and writing messages and connections to avoid problems with race conditions.
  • Use the flshm_close to free memory allocated by the library, and avoid memory leaks.

Bugs

If you find a bug or have compatibility issues, please open a ticket under issues section for this repository.

Pull requests are also welcome, but any changes must be cross-platform to be merged.

License

Copyright (c) 2016-2019 Alexander O'Mara

Licensed under the Mozilla Public License, v. 2.0.

If this license does not work for you, feel free to contact me.

Donations

If you find my software useful, please consider supporting independent and open-source software development by making a modest donation on my website at alexomara.com.

flshm's People

Contributors

alexanderomara avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

fantao963

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.